|
|
|
@ -3,29 +3,29 @@
@@ -3,29 +3,29 @@
|
|
|
|
|
Simple tool for sending email with sendmail, postfix or ssmtpd. |
|
|
|
|
|
|
|
|
|
Example: |
|
|
|
|
{{{ |
|
|
|
|
import pysema |
|
|
|
|
|
|
|
|
|
pysema.send( |
|
|
|
|
['alice@example.com', 'bob@example.com'], |
|
|
|
|
'really good subject line', |
|
|
|
|
'Message body goes here' |
|
|
|
|
) |
|
|
|
|
}}} |
|
|
|
|
```python |
|
|
|
|
import pysema |
|
|
|
|
|
|
|
|
|
pysema.send( |
|
|
|
|
['alice@example.com', 'bob@example.com'], |
|
|
|
|
'really good subject line', |
|
|
|
|
'Message body goes here' |
|
|
|
|
) |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
If you need to send some complex message, use [email.message][em] from the |
|
|
|
|
Python standard library to construct the message (including header fields) and |
|
|
|
|
pass it to the `send_message` function: |
|
|
|
|
|
|
|
|
|
{{{ |
|
|
|
|
import pysema |
|
|
|
|
from email.message import EmailMessage |
|
|
|
|
|
|
|
|
|
msg = EmailMessage() |
|
|
|
|
# compose message |
|
|
|
|
|
|
|
|
|
pysema.send_message(msg) |
|
|
|
|
}}} |
|
|
|
|
```python |
|
|
|
|
import pysema |
|
|
|
|
from email.message import EmailMessage |
|
|
|
|
|
|
|
|
|
msg = EmailMessage() |
|
|
|
|
# compose message |
|
|
|
|
|
|
|
|
|
pysema.send_message(msg) |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
if something goes whoopsie a `pysema.SendMailException` is raised. |
|
|
|
|
|
|
|
|
|