Create Beautiful Emails in Python

Mayil is an open-source Python library that helps you create stunning, professional HTML emails with ease. With its elegant API and modern components, craft pixel-perfect emails that look great across all clients - from simple text updates to rich interactive newsletters.

INSPIRED BY STREAMLIT

Example Code

from mayil import Mayil
import pandas as pd
import plotly.express as px

my = Mayil()

# Add a header
my.header("Monthly Report")

# Add metrics
my.metric("Active Users", "1,234")
my.metric("Conversion Rate", "24.5%")

# Create and add an interactive scatter plot
df = pd.DataFrame({
    'Engagement': [85, 92, 78, 95, 89, 70, 88, 91, 76, 85],
    'Satisfaction': [90, 85, 75, 88, 92, 72, 83, 89, 78, 86],
    'Users': [120, 250, 180, 300, 220, 150, 280, 210, 190, 240]
})
fig = px.scatter(df, x='Engagement', y='Satisfaction',
    size='Users', color='Engagement',
    title='User Engagement vs. Satisfaction',
    color_continuous_scale='viridis')
my.plotly_chart(fig)

# Add mentions
my.mention(["team@example.com", "dev@example.com"], color="#4A148C")

# Add a sticky note
my.sticky_note("Important Update", "New features are now available!")

# Add a table
df_table = pd.DataFrame({
    'Name': ['John', 'Jane'],
    'Score': ['95', '85']
})
my.table(df_table, align='center')

Output Preview

Monthly Report

Active Users
1,234
Conversion Rate
24.5%
User Engagement vs. Satisfaction
85
82
79
76
73
70
75
80
85
90
Engagement Score
Satisfaction Score
@team@example.com @dev@example.com
Important Update
New features are now available!
Name Score
John 95
Jane 85