Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shawwwn/uMail
A lightweight, scalable SMTP client for sending email in MicroPython
https://github.com/shawwwn/uMail
Last synced: 3 months ago
JSON representation
A lightweight, scalable SMTP client for sending email in MicroPython
- Host: GitHub
- URL: https://github.com/shawwwn/uMail
- Owner: shawwwn
- License: mit
- Created: 2018-09-18T13:50:27.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-18T07:42:10.000Z (4 months ago)
- Last Synced: 2024-07-18T09:47:10.358Z (4 months ago)
- Language: Python
- Size: 16.6 KB
- Stars: 77
- Watchers: 9
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-micropython - uMail - A lightweight, scalable SMTP client for sending email in MicroPython. (Libraries / Communications)
README
# µMail (MicroMail)
A lightweight, scalable SMTP client for sending email in MicroPython.## Usage:
A bare minimal approach
```py
import umail
smtp = umail.SMTP('smtp.gmail.com', 587, username='[email protected]', password='mypassword')
smtp.to('[email protected]')
smtp.send("This is an example.")
smtp.quit()
```## API docs:
* **`umail.SMTP(host, port, [ssl, username, password])`**
* **host** - smtp server
* **port** - server's port number
* **ssl** - set `True` when SSL is required by the server
* **username** - my username/email to the server
* **password** - my password* **`SMTP.login(username, password)`**
If you did not login when intializing the server, do it here!* **`SMTP.to(addrs, mail_from)`**
* **addrs** - Recipient's email address. If multiple recipents, use a list, eg. `['[email protected]', '[email protected]']`
* **mail_from** - manually specify the MAIL FROM address, default value is your smtp username. [example](examples/example_mail_from.py)* **`SMTP.write(content)`**
To send a long email or an email that contains large attachments, you will most likely exceed the memory limit of your MCU.\
Use this function to break up your email into smaller chunks.\
Each call to `write()` will cause the current `content` to be sent to the server so you can load the next chunk.* **`SMTP.send([content])`**
Finish writing the email.\
Make the SMTP server to actually send your email to the recipent address.* **`SMTP.quit()`**
Close the connection to the server## Other
For more details, pleasse refer to sample code under `examples\`