极大地简化了从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.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java应用程序重新启动,由于AndroidRuntime异常而无法运行   java在尝试运行javafx应用程序时在初始化中出错   java如何循环ArrayList并将每个值发送到下载管理器?   在Windows 10中将java应用程序注册为默认浏览器   java不能将类“X”强制转换为类“Y”,即使X扩展了Y?   java在接口Cloneable中找不到符号clone()   java追加数组并替换JSON对象中的键   java JDialog在Windows 10上的右监视器上的位置不正确,缩放比例为150%   JavaGWTP样板生成   返回一组所有组合的java递归方法   java处理MDB中的连接错误   RecyclerView中的java重复联系人   继承混淆与java方法重载   java如何在Mac OS X 10.7.5上运行Eclipse Oxy