Skip to main content

Quick send email use python3.

Project description

项目介绍

简易的邮件发信工具。支持认证/不认证发信。 使用UTF-8编码。可以一次连接声明多收件人、抄送人

安装

pip install quickemail

使用说明

简易的邮件发信工具。支持认证/不认证发信。 使用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. 错误显示输出String

    result = quicksend.authsend(msg)
    if result != True:
        print(result)
    
    result = quicksend.send(msg)
    if result != True:
        print(result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quickemail-0.1.7-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file quickemail-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: quickemail-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.4

File hashes

Hashes for quickemail-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ef435e51e96e815b3c8638024db9eb3c8c88da64e0a8fdc49f187bec7277fcc6
MD5 95f31b98731a5c929c2ea0ef9c227b78
BLAKE2b-256 bc23401f8b8752bb19acca4a697007579e83f5d682018a1e171f05b2f90ac68c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page