Send email

Links: notebook, html, PDF, python, slides, slides(2), GitHub

Send mails with attachments from a notebook.

with open("erty.txt", "w") as f:
import pymmails
server = pymmails.create_smtp_server("gmail", "", "pwd")

In fonction create_smtp_server, the string gmail is replaced by (tls version). By default, the server cannot be accessed unless IMAP is enabled (see Problems sending mail with POP or IMAP). You can usually find this string by searching on internet for your provider smtp server, you find pages such as configuration des serveurs sortants et entrants des principaux comptes mails. However, by doing this, you need to send your password. You should remove your password wherever it appears as soon as you don’t need it anymore. If you forget, I advise you to change it.

pymmails.send_email(server, "", "",
                "results", "body", attachements = [ "erty.txt" ])
(221, b'2.0.0 closing connection e18sm17176289wjz.27 - gsmtp')

Module keyring should be used to store password instead of letting them accessible in the notebook.