极大地简化了从python应用程序发送电子邮件的过程
MailShake的Python项目详细描述
尽管python使得通过smtplib模块发送电子邮件相对容易, 这个库提供了几个光包装。
这些包装使发送电子邮件更加快速,易于在 开发,并为无法使用SMTP的平台提供支持。
用法:
from mailshake import SMTPMailer mailer = SMTPMailer() mailer.send( subject='Hi', text_content='Hello world!', from_email='from@example.com', to=['mary@example.com', 'bob@example.com'] )
您还可以编写多条消息并同时发送它们:
from mailshake import SMTPMailer, EmailMessage mailer = SMTPMailer() messages = [] email_msg = EmailMessage( "Weekend getaway", 'Here's a photo of us from our trip.', 'from@example.com', ['mary@example.com', 'bob@example.com'] ) email_msg.attach("picture.jpg") messages.append(email_msg) … mailer.send_messages(messages)
- 可用邮件:
- smtpmailer
- amazonsesmailer
以及:
- ToConsoleMailer (prints the emails in the console)
- ToFileMailer (save the emails in a file)
- ToMemoryMailer (for testing)
- DummyMailer (does nothing)
copyright: | Juan-Pablo Scaletti. |
---|---|
license: | MIT, see LICENSE for more details. |