Simple Email Sender using Python 3.

Related tags

Emailemail-sender
Overview

Email Sender

使用 Python 3 实现的简单邮件发送工具。

Version: 0.1.2 (Beta)

主要功能

  • 使用 SMTP 协议发送邮件
  • 支持 SSL/TLS 、 STARTTLS 加密(为保证安全,强制加密发送)
  • 支持邮件模板与邮件生成
  • 支持向多人群发邮件
  • 日志记录
  • 脚本执行
  • 多线程发送邮件

邮件模板介绍

使用HTML格式编写模板,遵循如下正则表达式实现文本替换:

\{\s*%\s*(label)\s*%\s*\}

例如:

{% name %}

其中,label 为定位用于替换的标签,遵守 Python 变量名命名规则,且不为 receiver, subject, receiver_name, attachments, email_id 中的任意一个, 如例子中的 name

替换内容位于配置文件的 receivers.replace 和 template.global.replace 中, 可以分别设置每位接收者的替换信息和全局的替换信息。

当提供了不存在的 label 会被忽略,当模板中的标签没有可替换的项时会原样输出。

当发生替换时,整个标签都会被替换,如 {% name %},你好name=Holger 时会替换为 Holger,你好

template 目录中提供了一个模板可供参考。

配置文件介绍

使用 Yaml 作为配置文件,其具体格式如下:

mail:  # 发件方信息
  host: smtp.example.com  # smtp 服务器,请询问邮件服务提供商
  port: 587  # smtp 发送端口,请询问邮件服务提供商
  starttls: true  # 是否开启 starttls,默认为 false
  user: [email protected]  # 发送方 Email
  passwd: password  # 发送方密码或授权码
  name: Your name  # 可选,发送方名字
template:  # 邮件模板信息
  use_file: true  # 是否提供一个 html 文件作为模板
  file: /path/to/template/filename.html
  # 当 use_file=false, 须提供 content 作为模板的内容
  global:  # 全局配置,可选(每一项都可选),下方接收者的配置会将其覆盖
    subject: For Test  # 邮件主题,和下方的至少一个不为空
    attachments: []  # 附件文件路径列表
    replace:  # 替换内容 格式为 `label: 替换的文本` 下同
      message: This is a test email.
receivers:  # 接收者信息,为 yaml 数组
  -
    email: [email protected]  # 接收者 Email
    name: User  # 可选,接收者名字
    subject: For Test, Email Sender  # 邮件主题,和上方的至少一个不为空
    attachments: []  # 可选,附件文件路径列表
    replace:  # 替换内容 格式为 `label: 替换的文本`
      name: User

(计划内)测试的(发送)邮箱:

由于精力有限,欢迎提供不在列表内的其他邮箱测试!

  • Outlook
    • host: smtp.office365.com
    • port: 587
    • starttls: true
  • QQ Mail / foxmail.com
    • host: smtp.qq.com
    • port: 587 (starttls: true) 或 465 (starttls: false)
    • passwd: 填写授权码,请参考官方文档
  • 163 Mail
    • host: smtp.163.com

      126,yeah.net 邮箱请自行更换服务器地址中相关参数。例如 smtp.126.com 和 smtp.yeah.net

    • port: 465
    • starttls: false
    • passwd: 填写授权码,请参考官方文档
  • Gmail (需要更多测试)
    • host: smtp.gmail.com
    • port: 587 (starttls: true) 或 465 (starttls: false)

    需要能够正常访问 Gmail 的网络环境。若无法登录,请参考官方文档

  • SUDA 学生邮箱 stu.suda.edu.cn (使用该邮箱发送的邮件可能被认为是垃圾邮件)
    • host: smtp.stu.suda.edu.cn
    • port: 465
    • starttls: false

运行方法

  1. 从控制台运行:

    运行 console-tool.py 或者下载二进制文件,默认读取运行目录下的 config.ini 文件;可以指定 -c/--config 参数给出 Yaml 配置文件路径。

  2. 作为 package 附加于其他项目运行:

    参考 console-tool.py 的代码。实际上,可以将配置项存储为字典,调用 Poster.sender.send_email 并传入配置项即可。

Q&A

  • 遇到错误:SMTPAuthenticationError: (535, b'5.7.3 Authentication unsuccessful ...').

    请检查邮箱是否能够正常登录。

  • 遇到错误:SMTPServerDisconnected: Connection unexpectedly closed

    请检查端口是否有误。

You might also like...
GMailBomber is a form of Internet abuse which is perpetrated through the sending of massive volumes of email to a specific email address with the goal of overflowing the mailbox and overwhelming the mail server hosting the address, making it into some form of denial of service attack.

GMailBomber is a form of Internet abuse which is perpetrated through the sending of massive volumes of email to a specific email address with the goal of overflowing the mailbox and overwhelming the mail server hosting the address, making it into some form of denial of service attack.

Email-osint - Email OSINT tool written in python3
Email-osint - Email OSINT tool written in python3

Email-osint - Email OSINT tool written in python3

Simple, powerfull and nonobstructive django email middleware.

djmail djmail is a BSD Licensed, simple and nonobstructive django email middleware. Why use djmail? Because it: Sends emails asynchronously without ad

A simple library project, a library function to make a temporary email, receive all messages
A simple library project, a library function to make a temporary email, receive all messages

fake-email A simple library project, a library function to make a temporary email, receive all messages Installation : pip install fake-email Example

Spam-bot - Simple email-spammer discord bot

📝 Functional [ ✔️ ] Premium system via .json [ ✔️ ] Spammer [ ✔️ ] Validater [ ✔️ ] Discord bot ❓ How to launch ➡️ 1) Make discord bot ➡️ 2) Paste to

Send email in Python conveniently for gmail using yagmail
Send email in Python conveniently for gmail using yagmail

yagmail -- Yet Another GMAIL/SMTP client For the asynchronous asyncio version, look here: https://github.com/kootenpv/aioyagmail The goal here is to m

Command line interface for sending email using SMTP (ships with Gmail configuration).

mailsend Description Lightweight command line interface for sending email using SMTP. Default configuration is set for Gmail (smtp.gmail.com at port 5

Python email address and Mime parsing library

Flanker - email address and MIME parsing for Python Flanker is an open source parsing library written in Python by the Mailgun Team. Flanker currently

Disposable Temporary Email (Python Library)

Disposable Temporary Email (Python Library)

Releases(v0.1.2)
  • v0.1.2(Feb 13, 2022)

    Version: 0.1.2 (Beta)

    主要功能

    • 使用 SMTP 协议发送邮件
    • 支持 SSL/TLS 、 STARTTLS 加密(为保证安全,强制加密发送)
    • 支持邮件模板与邮件生成
    • 支持向多人群发邮件
    • 日志记录
    • 脚本执行
    • 多线程发送邮件

    邮件模板介绍

    使用HTML格式编写模板,遵循如下正则表达式实现文本替换:

    \{\s*%\s*(label)\s*%\s*\}
    

    例如:

    {% name %}
    

    其中,label 为定位用于替换的标签,遵守 Python 变量名命名规则,且不为 receiver, subject, receiver_name, attachments, email_id 中的任意一个, 如例子中的 name

    替换内容位于配置文件的 receivers.replace 和 template.global.replace 中, 可以分别设置每位接收者的替换信息和全局的替换信息。

    当提供了不存在的 label 会被忽略,当模板中的标签没有可替换的项时会原样输出。

    当发生替换时,整个标签都会被替换,如 {% name %},你好name=Holger 时会替换为 Holger,你好

    template 目录中提供了一个模板可供参考。

    配置文件介绍

    使用 Yaml 作为配置文件,其具体格式如下:

    mail:  # 发件方信息
      host: smtp.example.com  # smtp 服务器,请询问邮件服务提供商
      port: 587  # smtp 发送端口,请询问邮件服务提供商
      starttls: true  # 是否开启 starttls,默认为 false
      user: [email protected]  # 发送方 Email
      passwd: password  # 发送方密码或授权码
      name: Your name  # 可选,发送方名字
    template:  # 邮件模板信息
      use_file: true  # 是否提供一个 html 文件作为模板
      file: /path/to/template/filename.html
      # 当 use_file=false, 须提供 content 作为模板的内容
      global:  # 全局配置,可选(每一项都可选),下方接收者的配置会将其覆盖
        subject: For Test  # 邮件主题,和下方的至少一个不为空
        attachments: []  # 附件文件路径列表
        replace:  # 替换内容 格式为 `label: 替换的文本` 下同
          message: This is a test email.
    receivers:  # 接收者信息,为 yaml 数组
      -
        email: [email protected]  # 接收者 Email
        name: User  # 可选,接收者名字
        subject: For Test, Email Sender  # 邮件主题,和上方的至少一个不为空
        attachments: []  # 可选,附件文件路径列表
        replace:  # 替换内容 格式为 `label: 替换的文本`
          name: User
    

    (计划内)测试的(发送)邮箱:

    由于精力有限,欢迎提供不在列表内的其他邮箱测试!

    • [x] Outlook
      • host: smtp.office365.com
      • port: 587
      • starttls: true
    • [x] QQ Mail / foxmail.com
      • host: smtp.qq.com
      • port: 587 (starttls: true) 或 465 (starttls: false)
      • passwd: 填写授权码,请参考官方文档
    • [x] 163 Mail
      • host: smtp.163.com

        126,yeah.net 邮箱请自行更换服务器地址中相关参数。例如 smtp.126.com 和 smtp.yeah.net

      • port: 465
      • starttls: false
      • passwd: 填写授权码,请参考官方文档
    • [ ] Gmail (需要更多测试)
      • host: smtp.gmail.com
      • port: 587 (starttls: true) 或 465 (starttls: false)

      需要能够正常访问 Gmail 的网络环境。若无法登录,请参考官方文档

    • [x] SUDA 学生邮箱 stu.suda.edu.cn (使用该邮箱发送的邮件可能被认为是垃圾邮件)
      • host: smtp.stu.suda.edu.cn
      • port: 465
      • starttls: false

    运行方法

    1. 从控制台运行:

      运行 console-tool.py 或者下载二进制文件,默认读取运行目录下的 config.ini 文件;可以指定 -c/--config 参数给出 Yaml 配置文件路径。

    2. 作为 package 附加于其他项目运行:

      参考 console-tool.py 的代码。实际上,可以将配置项存储为字典,调用 Poster.sender.send_email 并传入配置项即可。

    Source code(tar.gz)
    Source code(zip)
    email-sender-0.1.2-Linux_x86_64(7.24 MB)
    email-sender-0.1.2-macOS(4.76 MB)
    email-sender-0.1.2-windows_x86_64.exe(7.42 MB)
  • v0.1.1(Feb 13, 2022)

    Email Sender Version: 0.1.1 (Alpha)

    主要功能

    • 使用 SMTP 协议发送邮件
    • 支持 SSL/TLS 、 STARTTLS 加密(为保证安全,强制加密发送)
    • 支持邮件模板与邮件生成
    • 支持向多人群发邮件
    • 日志记录
    • 脚本执行

    邮件模板介绍

    使用HTML格式编写模板,遵循如下正则表达式实现文本替换:

    \{\s*%\s*(label)\s*%\s*\}
    

    例如:

    {% name %}
    

    其中,label 为定位用于替换的标签,遵守 Python 变量名命名规则,且不为 receiver, subject, receiver_name, attachments 中的任意一个, 如例子中的 name

    替换内容位于配置文件的 receivers.replace 和 template.global.replace 中, 可以分别设置每位接收者的替换信息和全局的替换信息。

    当提供了不存在的 label 会被忽略,当模板中的标签没有可替换的项时会原样输出。

    当发生替换时,整个标签都会被替换,如 {% name %},你好name=Holger 时会替换为 Holger,你好

    template 目录中提供了一个模板可供参考。

    配置文件介绍

    使用 Yaml 作为配置文件,其具体格式如下:

    mail:  # 发件方信息
      host: smtp.example.com  # smtp 服务器,请询问邮件服务提供商
      port: 587  # smtp 发送端口,请询问邮件服务提供商
      starttls: true  # 是否开启 starttls,默认为 false
      user: [email protected]  # 发送方 Email
      passwd: password  # 发送方密码或授权码
      name: Your name  # 可选,发送方名字
    template:  # 邮件模板信息
      use_file: true  # 是否提供一个 html 文件作为模板
      file: /path/to/template/filename.html
      # 当 use_file=false, 须提供 content 作为模板的内容
      global:  # 全局配置,可选(每一项都可选),下方接收者的配置会将其覆盖
        subject: For Test  # 邮件主题,和下方的至少一个不为空
        attachments: []  # 附件文件路径列表
        replace:  # 替换内容 格式为 `label: 替换的文本` 下同
          message: This is a test email.
    receivers:  # 接收者信息,为 yaml 数组
      -
        email: [email protected]  # 接收者 Email
        name: User  # 可选,接收者名字
        subject: For Test, Email Sender  # 邮件主题,和上方的至少一个不为空
        attachments: []  # 可选,附件文件路径列表
        replace:  # 替换内容 格式为 `label: 替换的文本`
          name: User
    

    (计划内)测试的(发送)邮箱:

    由于精力有限,欢迎提供不在列表内的其他邮箱测试!

    • [x] Outlook
      • host: smtp.office365.com
      • port: 587
      • starttls: true
    • [x] QQ Mail / foxmail.com
      • host: smtp.qq.com
      • port: 587 (starttls: true) 或 465 (starttls: false)
      • passwd: 填写授权码,请参考官方文档
    • [x] 163 Mail
      • host: smtp.163.com

        126,yeah.net 邮箱请自行更换服务器地址中相关参数。例如 smtp.126.com 和 smtp.yeah.net

      • port: 465
      • starttls: false
      • passwd: 填写授权码,请参考官方文档
    • [ ] Gmail (需要更多测试)
      • host: smtp.gmail.com
      • port: 587 (starttls: true) 或 465 (starttls: false)

      需要能够正常访问 Gmail 的网络环境。若无法登录,请参考官方文档

    • [x] SUDA 学生邮箱 stu.suda.edu.cn (使用该邮箱发送的邮件可能被认为是垃圾邮件)
      • host: smtp.stu.suda.edu.cn
      • port: 465
      • starttls: false

    运行方法

    安装依赖:

    $ pip3 install -r requirements.txt
    
    1. 从控制台运行:

      运行 console-tool.py,默认读取运行目录下的 config.ini 文件;可以指定 -c/--config 参数给出 Yaml 配置文件路径。

    2. 作为 package 附加于其他项目运行:

      参考 console-tool.py 的代码。实际上,可以将配置项存储为字典,调用 Poster.sender.send_email 并传入配置项即可。

    Source code(tar.gz)
    Source code(zip)
Owner
SUMSC
SUMSC
Simple Email Sender using Python 3.

Email Sender 使用 Python 3 实现的简单邮件发送工具。 Version: 0.1.2 (Beta) 主要功能 使用 SMTP 协议发送邮件 支持 SSL/TLS 、 STARTTLS 加密(为保证安全,强制加密发送) 支持邮件模板与邮件生成 支持向多人群发邮件 日志记录 脚本执行

SUMSC 1 Feb 13, 2022
A SMTP server for use as a pytest fixture that implements encryption and authentication.

SMTPDFix: Test email, locally A simple SMTP server based on aiosmtpd for use as a fixture with pytest that supports encryption and authentication. All

James Warne 11 Sep 03, 2022
SMTP checker to check Mail Access via SMTP

SMTP checker to check Mail Access via SMTP with easy usage ! Medusa has been written and tested with Python 3.8. It should run on any OS as long as Python and all dependencies are installed.

h3x0 23 Dec 05, 2022
Suplantar mails de empresas como google, facebook, github, etc...

Suplantar mails de empresas como google, facebook, github, etc...

piter 3 Feb 05, 2022
Python library for sending emails.

Mail.py Python library for sending emails. Installation git clone https://github.com/SunPodder/Mail.py cd Mail.py python setup.py install Usage Imp

Sun 4 Nov 24, 2021
Great script for sending and spaming emails! gmail, yahoo, outlook, hotmail.

• License • Issues • Project • Wikipedia • Я не несу ответственности за ваши действия. Скачивая программное обеспечение из этого репозитория, вы согла

He1Zen 143 Dec 24, 2022
A python script that helps you understand why your E-Mail ended up in Spam

decode-spam-headers.py Whether you are trying to understand why a specific e-mail ended up in SPAM/Junk for your daily Administrative duties or for yo

Mariusz Banach 316 Jan 05, 2023
Read/sync your IMAP mailboxes (python2)

Upstream status (master branch): Upstream status (next branch): Financial contributors: Links: Official github code repository: offlineimap Website: w

OfflineIMAP 1.7k Dec 29, 2022
Heimdall watchtower automatically sends you emails to notify you of the latest progress of your deep learning programs.

This software automatically sends you emails to notify you of the latest progress of your deep learning programs.

Zhenyue Qin 22 Dec 06, 2021
A simple free API that allows you to extract abuse emails from IPs.

Abuse-Email-API A simple free API that allows you to extract abuse emails from IPs. also isnt worth 500 dollars :) Requirements A Debian based OS The

Keratin 1 Dec 20, 2021
A functional demo of the O365 Module to send an email on an authenticated, tokenized account.

O365_email A functional demo of the O365 Module to send an email on an authenticated, tokenized account. Prep Create an app in Azure Developer's porta

2 Oct 14, 2022
PGP encrypted / multipart templated emails for Django

Created by Stephen McDonald Introduction django-email-extras is a Django reusable app providing the ability to send PGP encrypted and multipart emails

stephenmcd 75 May 14, 2022
Mail hosting made simple

Modoboa Modoboa is a mail hosting and management platform including a modern and simplified Web User Interface. It provides useful components such as

Modoboa 2.4k Jan 03, 2023
SMTP In some vulnerable configurations, email servers can also be aggregated Use information that gives us information about the host or network Give

SMTP In some vulnerable configurations, email servers can also be aggregated Use information that gives us information about the host or network Give. The SMTP protocol supports some basic commands s

m3hr44n 1 Jan 16, 2022
A Django email backend that uses a celery task for sending the email.

django-celery-email - A Celery-backed Django Email Backend A Django email backend that uses a Celery queue for out-of-band sending of the messages. Wa

Paul McLanahan 430 Dec 16, 2022
Send e-mails to teachers with specified school-website using Aula, anonymously

Information : This only works in Denmark! Send e-mails to teachers with specified school-website using Aula, anonymously. Find your school via the att

Binary.club 1 Jan 24, 2022
Django module to easily send templated emails using django templates, or using a transactional mail provider (mailchimp, silverpop, etc.)

Django-Templated-Email Info: A Django oriented templated email sending class Author: Bradley Whittington (http://github.com/bradwhittington, http://tw

Vinta Software 659 Dec 27, 2022
Mail-Checker is a python script that lets you see your mails directly from the terminal without having to login each time.

Mail-Checker ##Mail-Checker is a python script that lets you see your mails directly from the terminal without having to login each time. ##Before you

Siddharth Pradeep 1 Jan 12, 2022
Python email address and Mime parsing library

Flanker - email address and MIME parsing for Python Flanker is an open source parsing library written in Python by the Mailgun Team. Flanker currently

Mailgun Team 1.6k Dec 29, 2022
A simple email sender

Email-Sender Un semplice Email-Sender che utilizza il modulo smtplib con aggiunta di interfaccia grafica realizzata con il modulo tkinter Per il corre

Vincenzo Caliendo 0 Jan 14, 2022