Skip to main content

Quick send email use python3.

Project description

QuickEmail

项目介绍

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

使用说明

    简易的邮件发信工具。支持认证/不认证发信。
    使用UTF-8编码。
    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(result)
         
     result = quicksend.send(msg)
     if result:
         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

quickemail-0.3.0-py3-none-any.whl (8.9 kB view hashes)

Uploaded Python 3

Supported by

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