From 9d5419566c04ea71e7a05402adadd795f6696a20 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sat, 17 May 2025 21:03:38 +0200 Subject: [PATCH 1/2] Add placeholder message content to example.py --- examples/example.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/example.py b/examples/example.py index fc15eb1..ee98508 100644 --- a/examples/example.py +++ b/examples/example.py @@ -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() From 4b7268d4ebac9e81589565fb176edab5d11a7e8b Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sat, 17 May 2025 21:06:55 +0200 Subject: [PATCH 2/2] Add minimal example script and update README with warning about date synchronization --- examples/README.md | 3 +++ examples/minimal.py | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 examples/minimal.py diff --git a/examples/README.md b/examples/README.md index 2236adb..e5ff5c7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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. diff --git a/examples/minimal.py b/examples/minimal.py new file mode 100644 index 0000000..37431af --- /dev/null +++ b/examples/minimal.py @@ -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()