-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add assume_markdown config flag (#31)
- Loading branch information
1 parent
64c912c
commit b553fe6
Showing
4 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ Muttdown's configuration file is written using [YAML][]. Example: | |
smtp_username: [email protected] | ||
smtp_password: foo | ||
css_file: ~/.muttdown.css | ||
assume_markdown: false | ||
|
||
|
||
If you prefer not to put your password in plaintext in a configuration file, you can instead specify the `smtp_password_command` parameter to invoke a shell command to lookup your password. The command should output your password, followed by a newline, and no other text. On OS X, the following invocation will extract a generic "Password" entry with the application set to "mutt" and the title set to "[email protected]": | ||
|
@@ -58,6 +59,8 @@ The `css_file` should be regular CSS styling blocks; we use [pynliner][] to inli | |
|
||
Muttdown can also send its mail using the native `sendmail` if you have that set up (instead of doing SMTP itself). To do so, just leave the smtp options in the config file blank, set the `sendmail` option to the fully-qualified path to your `sendmail` binary, and run muttdown with the `-s` flag | ||
|
||
If `assume_markdown` is true, then all input is assumed to be Markdown by default and the `!m` sigil does nothing. | ||
|
||
Installation | ||
------------ | ||
Install muttdown with `pip install muttdown` or by downloading this package and running `python setup.py install`. You will need the [PyYAML][] and [Python-Markdown][] libraries, as specified in `requirements.txt`. This should work with Python 3.6+. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,8 @@ smtp_username: [email protected] | |
smtp_password: foo | ||
.br | ||
css_file: ~/.muttdown.css | ||
.br | ||
assume_markdown: false | ||
.P | ||
If you prefer not to put your password in plaintext in a configuration file, you | ||
can instead specify the \fBsmtp_password_command\fR parameter to invoke a shell | ||
|
@@ -106,6 +108,9 @@ have that set up (instead of doing SMTP itself). To do so, just leave the smtp | |
options in the config file blank, set the \fBsendmail\fR option to the | ||
fully-qualified path to your \fBsendmail\fR binary, and run \fBmuttdown\fR with | ||
the \fB-s\fR flag | ||
.P | ||
If \fBassume_markdown\fR is true, then all input is assumed to be Markdown by | ||
default and the \fB!m\fR sigil does nothing. | ||
|
||
.SH AUTHORS | ||
\fBmuttdown\fR was written by James Brown <[email protected]>. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,3 +310,18 @@ def test_raw_unicode(basic_config): | |
converted = process_message(mail, basic_config) | ||
assert converted["From"] == "Test <[email protected]>" | ||
assert "Ø" in converted.get_payload() | ||
|
||
|
||
def test_assume_markdown(basic_config): | ||
msg = Message() | ||
msg["Subject"] = "Test Message" | ||
msg["From"] = "[email protected]" | ||
msg["To"] = "[email protected]" | ||
msg["Bcc"] = "bananas" | ||
msg.set_payload("This message has no **sigil**") | ||
|
||
basic_config.merge_config({"assume_markdown": True}) | ||
|
||
converted = process_message(msg, basic_config) | ||
html_part = converted.get_payload()[1].get_payload(decode=True) | ||
assert html_part == b"<p>This message has no <strong>sigil</strong></p>" |