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)