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
Automated email sending application.

autoMail Automated email sending application. This application sends email to a user when added to database. Email message contains the temperature of

Bhat Owais 1 Feb 12, 2022
Djrill is an email backend and new message class for Django users that want to take advantage of the Mandrill transactional email service from MailChimp.

Djrill: Mandrill Transactional Email for Django Djrill integrates the Mandrill transactional email service into Django. PROJECT STATUS: INACTIVE As of

Brack3t 327 Oct 01, 2022
Pysces (read: Pisces) is a program to help you send emails with an user-customizable time-based scheduling.

Pysces (Python Scheduled-Custom-Email-Sender) Pysces (read: Pisces) is a program to help you send emails with an user-customizable time-based email se

Peter 1 Jun 16, 2022
this is django project through this project you can easily sends message to any email

SEND-EMAIL this is django project through this project you can easily sends message to any email home when you run the server then you will see this t

Ankit jadhav 1 Oct 17, 2021
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
This library is helpful when creating accounts, it has everything you need for this

AccountGeneratorHelper Library to facilitate accounts generation. Unofficial API for temp email services. Receive SMS from free services. Parsing and

Denis 52 Jan 07, 2023
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
Bulk send personalized emails using a .csv file and Gmail API (via EZGmail)

GSender Bulk send personalized emails using a .csv file and Gmail API (via EZGmail). Installation Install requirements.txt. Follow the EZGmail Install

1 Nov 23, 2021
Email-osint - Email OSINT tool written in python3

Email-osint - Email OSINT tool written in python3

Surtains 7 Nov 28, 2022
:incoming_envelope: IMAP/SMTP sync system with modern APIs

Nylas Sync Engine The Nylas Sync Engine provides a RESTful API on top of a powerful email sync platform, making it easy to build apps on top of email.

Nylas 3.5k Dec 23, 2022
ok-mail-helper是一个基于imap/smtp协议邮件客户端,使用python3.x开发

ok-mail-helper ok-mail-helper是一个基于imap/smtp协议邮件客户端,使用python3.x开发,支持邮件接收并解析、邮件发送,用户可在自己的项目中直接引入、开箱即用,或者结合flask等web框架轻松做成http接口供前端调用、把邮箱管理集成到自己的系统中,亦可通过

xlvchao 1 Feb 08, 2022
send email & telegram message whenever an analog in is recieved

send email & telegram message whenever an analog in is recieved (so when attached to an alarm siren out it will alert via mail)

Naor Livne 2 Feb 11, 2022
This is a bot that interacts with you over voice and sends mail.Uses speech_recognition,pyttsx3 and smtplib

AutoMail This is a bot that interacts with you over voice and sends mail Before you run the bot , go to mail.py and put your respective email address

Aditya Subrahmanya Bhat 2 Nov 04, 2022
xxnx its a simple smtp tool for mails spaming

xxnx its a simple smtp tool for mails spaming what is smpt? Simple Mail Transfer Protocol or smtp service. The Simple Mail Transfer Protocol (SMTP) is

0xD4$H 3 Feb 27, 2022
An email generator code in python language

An email generator code in python language. I have done it in the simplest way possible and with no link to an SMTP server. Generating infinite emails until CTRL+C . It is a code that can be used in

Kelvin Ndungu Wanja 1 Jan 17, 2022
faceFarm is an active yahoo email detection script that functions to take over the facebook account using email.

faceFarm – The simple Email Detector. Email Valid Detector for Facebook (Yahoo) faceFarm is an active yahoo email detection script that functions to t

Fadjrir Herlambang 2 Jan 18, 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
ghotok mail - lets you find available contact email addresses from target website

ghotok-mail ghotok mail - lets you find available contact email addresses from target website git clone https://github.com/josifkhan/ghotok-mail cd gh

Md Josif Khan 3 Mar 14, 2022
EmailAll - a powerful Email Collect tool

EmailAll A powerful Email Collect tool 0x1 介绍 😲 EmailAll is a powerful Email Co

473 Dec 22, 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