Skip to main content

QuickEmail

项目介绍

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

使用说明

    简易的邮件发信工具。支持认证/不认证发信。
    使用UTF-8编码。
    pip install quickemail
    from quickemail import QuickEmail
  1. 发信前先定义发信要素:

     指定主机和端口,必须参数:
     quicksend = QuickEmail('mail.test.com', 25)    # SMTP发信端口,默认是25 SSL链接使用465
     quicksend.debug = True                         # 打开调试,发送错误会抛出异常信息
     定义HELO主机名,参数可省略:
     quicksend.helo = 'QuickEmail'                 # HELO主机名不能使用有空格的字符串,可以省略
     quicksend.tls = True / quicksend.ssl = True   # 开启startTLS或者SSL,SSL端口一般为465
     认证用户名和密码,authsend()必须的参数:
     quicksend.mail_user = 'a'                     # 认证用户名
     quicksend.user_pass = 'test'                  # 认证用户的密码
    
     发信人、收信人为必须参数:
     quicksend.mail_from = 'AA高A<a@test.com>'    # 发信人地址,格式为:   FullName<email address>
     quicksend.mail_to = '一二三<123@test.com>,ABC<abc@test.com>'    # 格式同上,多地址使用逗号","分隔
    
     抄送人,可省略:
     quicksend.mail_cc = '一二三<123@test.com>'
     
     邮件时间定义,可省略:
     quicksend.mail_date = 1691544067
    
     邮件主题、内容,支持使用HTML: 
     quicksend.mail_subject = 'mY subject还有中文!'
     quicksend.mail_content = '<font color=red>red content一段中文</font>'
     quicksend.is_html = True
    
     添加附件,可省略:
     quicksend.mail_attach = ['abc.jpg']           # 添加附件 类型为list
     
     高级定制,可省略:
     quicksend.content_from = '邮件显示的假发件人<from@test.com>'      # 定制邮件信体显示的发件人,一般为来隐藏实际的mail_from。
     quicksend.content_to = '邮件显示的假收件人<to@test.com>'      # 定制邮件信体显示的收件人,一般为来隐藏实际的mail_to。
     quicksend.content_cc = '邮件显示的假抄送人<cc@test.com>'      # 定制邮件信体显示的抄送人,一般为来隐藏实际的mail_cc。
    
  2. 使用creatmsg()建立邮件信体内容。(可以忽略)

     msg = quicksend.creatmsg()
    
  3. 使用authsend()或者send()发送邮件,creatmsg()未执行,参数msg可忽略。

     quicksend.authsend(msg)
     quicksend.send()
    
  4. 错误显示(成功返回True,失败返回False)

     result = quicksend.authsend(msg)
     if result:
         print("ok")
    

    打开调试,发送错误会抛出异常信息

     quicksend.debug = True
     try:
         quicksend.authsend()
     except Exception as e:
         print(e)
    

Release files for quickemail 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for quickemail 0.4.0
File Interpreter ABI Platform
quickemail-0.4.0-py3-none-any.whl Python 3 none any Details

Release files / quickemail-0.4.0-py3-none-any.whl

Download URL quickemail-0.4.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46aec0600f277771d3608b3454d2ae15af2b3923a80b2241b234dde4c2352130
BLAKE2b-256 checksum
How to use checksums
247eef8dd55620d15dacba402c73dc13bf751156c0b4da4b8a27000fe395ac01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6

Release history Release notifications | RSS feed

This release

0.4.0 This release

1 release file

0.3.0

1 release file

0.2.9

1 release file

0.2.8

1 release file

0.2.7

1 release file

0.2.6

2 release files

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.0

2 release files

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

2 release files

0.1.5

2 release files

0.1.4

1 release file

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page