Red-mail - Advanced email sending library for Python

Overview

Red Mail

Next generation email sender


Pypi version build codecov Documentation Status PyPI pyversions

What is it?

Red Mail is an advanced email sender library. It makes sending emails trivial and has a lot of advanced features such as:

  • Attachments
  • Templating (via Jinja)
  • Prettified tables
  • Embedded images

See more from the documentations or see release from PyPI.

Why Red Mail?

Sending emails should not be this complicated:

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

msg = MIMEMultipart('alternative')
msg['Subject'] = 'An example email'
msg['From'] = '[email protected]'
msg['To'] = '[email protected]'

part1 = MIMEText("Hello!", 'plain')
part2 = MIMEText("<h1>Hello!</h1>", 'html')

msg.attach(part1)
msg.attach(part2)

# Send the message via our own SMTP server.
s = smtplib.SMTP('localhost', port=0)
s.send_message(msg)
s.quit()

With Red Mail, it's simple as this:

from redmail import EmailSender

email = EmailSender(host="localhost", port=0)

email.send(
    subject="An example email",
    receivers=['[email protected]'],
    text="Hello!",
    html="<h1>Hello!</h1>"
)

You can also do more advanced things easily with it:

from redmail import EmailSender

email = EmailSender(host="localhost", port=0)

email.send(
    subject="An example email",
    sender="[email protected]",
    receivers=['[email protected]'],
    html="""<h1>Hello {{ friend }}!</h1>
        <p>Have you seen this thing</p>
        {{ awesome_image }}
        <p>Or this:</p>
        {{ pretty_table }}
        <p>Or this plot:</p>
        {{ a_plot }}
        <p>Kind regards, {{ sender.full_name }}</p>
    """,

    # Content that is embed to the body
    body_params={'friend': 'Jack'},
    body_images={
        'awesome_image': 'path/to/image.png',
        'a_plot': plt.Figure(...)
    },
    body_tables={'pretty_table': pd.DataFrame(...)},

    # Attachments of the email
    attachments={
        'some_data.csv': pd.DataFrame(...),
        'file_content.html': '<h1>This is an attachment</h1>',
        'a_file.txt': pathlib.Path('path/to/file.txt')
    }
)

Author

Owner
Mikael Koli
Data programmer with background in finance and analytics.
Mikael Koli
scrapes medias, likes, followers, tags and all metadata. Inspired by instagram-php-scraper,bot

instagram_scraper This is a minimalistic Instagram scraper written in Python. It can fetch media, accounts, videos, comments etc. `Comment` and `Like`

sirjoe 2.5k Nov 16, 2022
The smart farm is an idea that designing Smart Farm by IoT

The smart farm is an idea that designing Smart Farm by IoT. Using Raspberry Pi 4 detect the data from different sensors(Raindrop sensor and DHT22 sensor), and push the data to Azure IoT central.

Jiage 1 Jan 11, 2022
A community made discord bot coded in Python and running on AWS.

Pogbot Project Open Group Discord This is an open source community ran project. Join the discord for more information on how to participate. Coded in

Project Open Group 2 Jul 27, 2022
Just a simple discord bot a create for try

WAIFU MATERIAL DISCORD BOT! French ver. here HOW TO LAUNCH First, clone this rep

1 Jan 08, 2022
Python3 script to dump employee information from XING API

XingDumper Python 3 script to dump company employees from XING API. Perfect OSINT tool ;-) The results contain firstname, lastname, position, gender,

LRVT 11 Dec 26, 2022
自动每天给女友发邮件

github acitons 发邮件 python 脚本 每天 7点半左右给女朋友发送邮件 天气来自: http://www.tianqiapi.com/ 文字图片来源:http://wufazhuce.com/ 风景图:https://qqlykm.cn/api/fengjing 土味情话:htt

gogobody 7 May 12, 2022
Download videos from Youtube and other platforms through a Telegram Bot

ytdl-bot Download videos from YouTube and other platforms through a Telegram Bot Usage: https://t.me/benny_ytdlbot Send link from YouTube directly to

Telegram Bot Collection 289 Jan 03, 2023
This tool adds votes to strawpoll.me polls.

Strawpoll-Botter This tool adds votes to strawpoll.me polls. Usage Basic usage: py main.py -r amount of votes to put poll id option # Usage: py

MonkeySkid 2 Feb 28, 2022
An iCal file to transport you to a new place every day until you die

everydayvirtualvacation An iCal file to transport you to a new place every day until you die The library is closed 😔 😔 including a video of the plac

Jacob Chapman 33 Apr 19, 2022
Python tool to Check running WebClient services on multiple targets based on @leechristensen

WebClient Service Scanner Python tool to Check running WebClient services on multiple targets based on @tifkin_ idea. This tool uses impacket project.

Pixis 153 Dec 28, 2022
A modern, easy to use, feature-rich, and async ready API wrapper improved and revived from original discord.py.

A Python API wrapper that is improved and revived from the original discord.py

Orion 19 Nov 06, 2021
DISCORD script to automate sending messages to a particular server

discord discord script This script sends random quotes to an discord server and tags random users on the server in the process MADE WITH LOVE BY SACS

Solomon ogu 1 Nov 06, 2021
AWS Lambda Fast API starter application

AWS Lambda Fast API Fast API starter application compatible with API Gateway and Lambda Function. How to deploy it? Terraform AWS Lambda API is a reus

OBytes 6 Apr 20, 2022
Uses discords api to see if a token has a valid payment method.

Discord Payment Checker Uses discords api to see if a token has a valid payment method. Report Bug · Request Feature Features Checks tokens Checks all

dropout 10 Dec 01, 2022
Chorok - High quality Discord music bot

Chorok - High quality Discord music bot Rewrite with dico Config guide

Chorok Opensource project 10 May 03, 2022
Receive GitHub webhook events and send to Telegram chats with AIOHTTP through Telegram Bot API

GitHub Webhook to Telegram Receive GitHub webhook events and send to Telegram chats with AIOHTTP through Telegram Bot API What this project do is very

Dash Eclipse 33 Jan 03, 2023
Weather App using openweathermap API

This is my hobby project used to learn how to use public api for project.In this i used the api of openweathermap to featch the weather details of various city across the globe by giving city name as

Subramanya K S 1 Nov 06, 2021
A simple Telegram bot which handles images in whole different way

zeroimagebot thezeroimagebot 🌟 I Can Edit Dimension Of An image which is required by @stickers 🌟 I Can Extract Text From An Image 🌟 !!! New Updates

RAVEEN KUMAR 4 Jul 01, 2021
Huan Xu 1.6k Jan 04, 2023
Generate discord nitro codes and check them

Discord Nitro Generator and Checker A discord nitro generator and checker for all your nitro needs Explore the docs » Report Bug · Request Feature · J

509 Jan 02, 2023