Compare commits
2 commits
65c23ca231
...
0ddfecf171
Author | SHA1 | Date | |
---|---|---|---|
0ddfecf171 | |||
22495ef051 |
2 changed files with 44 additions and 0 deletions
35
examples/example.py
Normal file
35
examples/example.py
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import ntptime
|
||||||
|
from machine import RTC
|
||||||
|
|
||||||
|
from micromail import MicromailClient
|
||||||
|
|
||||||
|
# Use NTP to synchronize time
|
||||||
|
rtc = RTC()
|
||||||
|
ntptime.settime()
|
||||||
|
|
||||||
|
# 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
|
||||||
|
client.headers(
|
||||||
|
{
|
||||||
|
"subject": "Test",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
# Write message content
|
||||||
|
client.write_message("Hello world!")
|
||||||
|
client.write_message("Ceci est un message très intéressant.")
|
||||||
|
# Send message
|
||||||
|
client.send()
|
||||||
|
|
||||||
|
client.quit()
|
9
package.json
Normal file
9
package.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"urls": [
|
||||||
|
["micromail/__init__.py", "micromail/__init__.py"]
|
||||||
|
],
|
||||||
|
"deps": [
|
||||||
|
["datetime", "latest"]
|
||||||
|
],
|
||||||
|
"version": "0.1.0"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue