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, 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

David Barragán Merino 77 Aug 30, 2021
Using this repository you can send mails to multiple recipients.Was created in support of Ukraine, to turn society`s attention to war.

mails-in-support-of-UA Using this repository you can send mails to multiple recipients.Was created in support of Ukraine, to turn society`s attention

Oleksii Budzinskiy 2 Mar 04, 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
Churn Emails Inbox - Churn Emails Inbox Using Python

Churn Emails Inbox In this project, I have used the Python programming langauge

2 Nov 13, 2022
You take an email and password from the combo list file and check it on mail.com

Brute-Force-mail tool information: Combo Type: email:pass Domains: All domains of the site Url: https://www.mail.com Api: ☑️ Proxy: No ☑️ The correct

6 Jun 05, 2022
An automation program that checks whether email addresses are real, whether they exist and whether they are a validated mail

Email Validator It is an automation program that checks whether email addresses are real, whether they exist and whether they are a validated mail. Re

Ender MIRIZ 4 Dec 22, 2021
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
📧 CLI to deduplicate mails from mail boxes.

Mail Deduplicate Command-line tool to deduplicate mails from a set of boxes. Stable release: Development: Features Duplicate detection based on cherry

Kevin Deldycke 134 Dec 14, 2022
Esio_dev 3 Oct 15, 2021
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

Keith Mathe 1 Mar 22, 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
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 python program capable of accessing passwords associated with emails through leaked databases.

passfind A python program capable of accessing passwords associated with emails through leaked databases. A python program capable of accessing passwo

6 Aug 14, 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
Tempmail API aswell as a SMTP server.

Tempmail API/Server Tempmail API aswell as a SMTP server. Website · Report Bug · Request Feature Setup Firstly create a mongodb account, and proceed t

femboy.party 16 Mar 09, 2022
Certificate generating and mailing system

skylab-certificate-system Through the this system, you can generate personalized certificates for people with name-surname-mail information in an exce

Oğuzhan Ercan 9 Sep 27, 2022
Will iterate through a list of emails on an attached csv file and email all of them a message of your choice

Email_Bot Will iterate through a list of emails on an attached csv file and email all of them a message of your choice. Before using, make sure you al

J. Brandon Walker 1 Nov 30, 2021
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

Pascal van Kooten 2.4k Dec 31, 2022
This Tool Is For Sending Emails From A Terminal(Termux/Kali) etc.

This is a Basic python script to send emails from a Terminal(Termux/Kali) are the only tested currently.

AnonyVox 2 Apr 04, 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