A simple and comprehensive Python SMTP Mailer module
to_recipients = ['to1@email.tld','to2@email.tld']
cc_recipients = ['cc1@email.tld','cc2@email.tld']
bcc_recipients = ['bcc1@email.tld','bcc2@email.tld']
subject = 'PyMailer SMTP mail transport client testing'
message = 'Your message here. accept plain text, html text, or file path'
attachements =[
os.path.join(location_path_to, 'file1.pdf'),
os.path.join(location_path_to, 'file2.png'),
os.path.join(location_path_to, 'file3.gpg'),
os.path.join(location_path_to, 'file4.txt'),
]
smtp = SmtpClient()
smtp.use.encryption = False
smtp.use.tls = True
smtp.server.address='smtp.server.tld'
smtp.server.timeout=60 (optional)
smtp.server.port=587 (optional) # i.e: default ports| standard: 25, ssl: 465, tls: 587
smtp.server.auth.user='you@server.tld'
smtp.server.auth.password='s3cret!'
smtp.mail.addTo(to_recipients)
smtp.mail.addCc(cc_recipients) (optional)
smtp.mail.addBcc(bcc_recipients) (optional)
smtp.mail.addSubject(subject)
smtp.mail.addBody(message)
smtp.mail.addAttachments(attachements) (optional)
smtp.execute()
In Progress ... 1