Quick send email use python3.
Project description
# QuickEmail
#### 项目介绍
简易的邮件发信工具。支持认证/不认证发信。
使用UTF-8编码。可以一次连接声明多收件人、抄送人
#### 使用说明
简易的邮件发信工具。支持认证/不认证发信。
使用UTF-8编码。
from quickemail import QuickEmail
1. 发信前先定义发信要素:
指定主机和端口,必须参数:
quicksend = QuickEmail('mail.nmla.cn', 25) # SMTP发信端口,默认是25 SSL链接使用465
定义HELO主机名,参数可省略:
quicksend.set_helo('QuickEmail') # HELO主机名不能使用有空格的字符串
认证用户名和密码,authsend()必须的参数:
quicksend.set_mail_user('a') # 认证用户名
quicksend.set_user_pass('test') # 认证用户的密码
发信人、收信人为必须参数:
quicksend.set_mail_from('AA高丽A<a@nmla.cn>') # 发信人地址,格式为: FullName<email address>
quicksend.set_mail_to('一二三<123@nmla.cn>,ABC<abc@nmla.cn>') # 格式同上,多地址使用逗号","分隔
抄送人,可省略:
quicksend.set_mail_cc('一二三<123@nmla.cn>,中语言C<abc@nmla.cn>,AA高丽A<a@nmla.cn>')
邮件主题、内容,支持使用HTML:
quicksend.set_mail_subject('mY subject还有中文!')
quicksend.set_mail_content('<font color=red>red content一段中文</font>')
quicksend.set_is_html(True)
添加附件,可省略:
quicksend.set_mail_attach(['abc.jpg']) # 添加附件 类型为list
高级定制,可省略:
quicksend.set_content_from('邮件显示的假发件人<from@nmla.cn>') # 定制邮件信体显示的发件人,一般为来隐藏实际的mail_from。
quicksend.set_content_to('邮件显示的假收件人<to@nmla.cn>') # 定制邮件信体显示的收件人,一般为来隐藏实际的mail_to。
quicksend.set_content_cc('邮件显示的假抄送人<cc@nmla.cn>') # 定制邮件信体显示的抄送人,一般为来隐藏实际的mail_cc。
2. 使用creatmsg()建立邮件信体内容。
msg = quicksend.creatMsg()
3. 使用authsend()或者send()发送邮件。
quicksend.authsend(msg) # 认证发信
quicksend.send(msg) # 不认证发信
4. 错误显示
result = quicksend.authsend(msg)
if result != True:
print(result)
result = quicksend.send(msg)
if result != True:
print(result)
#### 项目介绍
简易的邮件发信工具。支持认证/不认证发信。
使用UTF-8编码。可以一次连接声明多收件人、抄送人
#### 使用说明
简易的邮件发信工具。支持认证/不认证发信。
使用UTF-8编码。
from quickemail import QuickEmail
1. 发信前先定义发信要素:
指定主机和端口,必须参数:
quicksend = QuickEmail('mail.nmla.cn', 25) # SMTP发信端口,默认是25 SSL链接使用465
定义HELO主机名,参数可省略:
quicksend.set_helo('QuickEmail') # HELO主机名不能使用有空格的字符串
认证用户名和密码,authsend()必须的参数:
quicksend.set_mail_user('a') # 认证用户名
quicksend.set_user_pass('test') # 认证用户的密码
发信人、收信人为必须参数:
quicksend.set_mail_from('AA高丽A<a@nmla.cn>') # 发信人地址,格式为: FullName<email address>
quicksend.set_mail_to('一二三<123@nmla.cn>,ABC<abc@nmla.cn>') # 格式同上,多地址使用逗号","分隔
抄送人,可省略:
quicksend.set_mail_cc('一二三<123@nmla.cn>,中语言C<abc@nmla.cn>,AA高丽A<a@nmla.cn>')
邮件主题、内容,支持使用HTML:
quicksend.set_mail_subject('mY subject还有中文!')
quicksend.set_mail_content('<font color=red>red content一段中文</font>')
quicksend.set_is_html(True)
添加附件,可省略:
quicksend.set_mail_attach(['abc.jpg']) # 添加附件 类型为list
高级定制,可省略:
quicksend.set_content_from('邮件显示的假发件人<from@nmla.cn>') # 定制邮件信体显示的发件人,一般为来隐藏实际的mail_from。
quicksend.set_content_to('邮件显示的假收件人<to@nmla.cn>') # 定制邮件信体显示的收件人,一般为来隐藏实际的mail_to。
quicksend.set_content_cc('邮件显示的假抄送人<cc@nmla.cn>') # 定制邮件信体显示的抄送人,一般为来隐藏实际的mail_cc。
2. 使用creatmsg()建立邮件信体内容。
msg = quicksend.creatMsg()
3. 使用authsend()或者send()发送邮件。
quicksend.authsend(msg) # 认证发信
quicksend.send(msg) # 不认证发信
4. 错误显示
result = quicksend.authsend(msg)
if result != True:
print(result)
result = quicksend.send(msg)
if result != True:
print(result)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quickemail-0.1.2.tar.gz
(7.4 kB
view hashes)
Built Distribution
Close
Hashes for quickemail-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65409bbae4bb39e4916c9a05243644ad12f2caaf27d6f4b7a290c285d02e94f9 |
|
MD5 | 843db439d7aa89c2b1972fcc2aad16b6 |
|
BLAKE2b-256 | bc540444d7ac59d752265c7a928ec52ae6ed4add10c7a6f9cf3e053ada7d170e |