Compare commits
2 commits
fb778c325a
...
4b7268d4eb
Author | SHA1 | Date | |
---|---|---|---|
4b7268d4eb | |||
9d5419566c |
3 changed files with 29 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
|||
# Examples
|
||||
|
||||
- [Recommended usage with NTP time synchronization](example.py)
|
||||
- [Minimal example](minimal.py)[^warning-date]
|
||||
|
||||
[^warning-date]: Warning: this will send an email with a very wrong date if the time was not synchronized on the device.
|
||||
|
|
|
@ -31,6 +31,7 @@ client.headers(
|
|||
# Write message content
|
||||
client.write_line("Hello world!\n")
|
||||
client.write_line("Ceci est un message très intéressant.\n")
|
||||
client.write_line("...\n")
|
||||
# Send message
|
||||
client.send()
|
||||
|
||||
|
|
25
examples/minimal.py
Normal file
25
examples/minimal.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from micromail import MicromailClient
|
||||
|
||||
# Create an SMTP client
|
||||
client = MicromailClient(
|
||||
host="mail.example.com",
|
||||
port=465,
|
||||
ssl=True,
|
||||
)
|
||||
|
||||
# Connect to the server
|
||||
client.connect()
|
||||
# Login to the server
|
||||
client.login("example@example.com", "password")
|
||||
# Initialize a new message
|
||||
client.new_message("example@example.org")
|
||||
# Set message headers
|
||||
# WARNING: This will send a message with a very wrong date if time is not correct on the device
|
||||
# --- It might be rejected by the mail server
|
||||
client.headers()
|
||||
# Write message content
|
||||
client.write_line("Hello world!\n")
|
||||
# Send message
|
||||
client.send()
|
||||
|
||||
client.quit()
|
Loading…
Add table
Add a link
Reference in a new issue