Tinysmtp的fork,具有bug修复和Python3兼容性

mailsend的Python项目详细描述


这是叉子 Rick Harris’s tinysmtp package 有一些修复和python 3兼容性。

示例:

with Mail().connect() as mail:
    msg = Message(
        'alice@example.com', 'Subject', ['bob@example.com'], body='body')
    mail.send(msg)

可以从环境变量中指定的url配置连接:

export MAILSEND_URL="smtp+tls://user:password@server.example.org/"

或作为单独变量:

export MAILSEND_HOSTNAME=server.example.org
export MAILSEND_PORT=25

或代码:

mail = Mail('smtp://server.example.org/')
mail2 = Mail('server.example.org',
             port=25,
             ssl=True,
             username='x',
             password='x')

呼叫mail.send发送消息:

mail = Mail('smtp://server.example.org/')
mail.send(sender='alice@example.com',
          recipients=['bob@example.com', 'charlie@example.com'],
          body='Hello everyone!',
          html='<p>Hello everyone!</p>',
          subject='Hello')

或者使用消息类逐段构造消息:

msg = Message('alice@example.com', 'Hello!')
msg.body = 'Hello'
msg.recipients = ['bob@example.com']
msg.cc = ['charlie@example.org']
msg.bcc = ['dina@example.org']

mail = Mail('smtp://server.example.org/')
mail.send(msg)

要在一个连接中发送多条消息,请使用Mail.connect

with mail.connect() as conn:
    conn.send(msg1)
    conn.send(msg2)

0.1.5(发布日期:2019-06-18)

  • 错误修复:如果提供了重复的邮件ID头,则不要添加该头

0.1.4(发布日期:2017-08-27)

  • 错误修复:Extra_Headers选项现在与Python3兼容

0.1.3(发布日期:2017-04-19)

  • 增加了通过mailsend发送stdlib email.message.message对象的功能

0.1.2(发布日期:2016-09-02)

  • html电子邮件的mime结构现在与outlook 2011兼容
  • 当消息包含utf-8地址时,将请求smtputf8扩展名。 (仅在Python3.5中提供此功能)

0.1.1(发布日期:2015-12-21)

  • 与envparse-0.2兼容的修复程序

0.1(2015-12-19发布)

  • https://github.com/rconradharris/tinysmtp
  • 分叉
  • 通过url添加了配置(例如Connection('smtp://user@example.org')
  • 各种错误修复
  • 向邮件类构造函数方法添加了rewrite_to参数。这会导致 所有要重写到给定地址的消息,并且 预期用于开发/测试。
  • 向邮件类构造函数方法添加了bcc参数。这会导致 所有要密送到给定地址的邮件。
  • 向邮件类构造函数添加了suppress_send参数。这个 导致消息无法发送(但仍可以通过 Mail.subscribe

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

推荐PyPI第三方库


热门话题
Spring 4升级后未加载java应用程序上下文   java Android 2.3.3 internet可以在我的Galaxy S上运行,但不能在我的Galaxy选项卡上运行?(许可?)   java通过不改变其原始位置对大小写字母进行排序   java Spring Boot一直在破坏我的电脑。。。sts的最佳配置是什么。Windows 10上的ini文件?   css Java Spring+引导问题   java Jackson将GeoJsonPoint序列化为纬度/经度   xml Java Transformer:如何将其结果生成OutputStream?   java如何更改字体、文本大小和设置文本位置?   在JavaSpringHibernate3.6.3中,如何告诉一个方法等待,直到获得锁,以及如何重试失败的事务?   java安卓服务代替线程   Java Swing使用鼠标移动JFrame