send-email
Send emails via SMTP with support for HTML formatting, file attachments, and email templates. Use when users ask to: (1) Send an email, (2) Email someone, (3) Send a notification, (4) Use email templates, or (5) Send files via email.
By wangyendt · 649 installs
npx skills add wangyendt/wayne-skills --skill send-email
Source repository · Upstream listing
Send Email
Send emails via SMTP using Python with support for plain text, HTML formatting, file attachments, and template based emails.
Key Features
Default Sender Email : Automatically uses agent skill test@126.com when no sender is specified
Automatic Markdown to HTML : Detects Markdown content and converts to beautifully styled HTML
Multiple Email Providers : Supports Gmail, Outlook, QQ Mail, 163/126 Mail, and custom SMTP
File Attachments : Attach multiple files to emails
Email Templates : Use template files with variable substitution
Interactive Email Sending Flow
This skill guides you through the email sending process step by step.
Step 1: Collect Basic Email Information
Ask the user for the following required information. If any is missing, prompt the user to provide it:
Information Description Example
Recipient ( to ) Email address to send to user@example.com
Subject ( subject ) Email subject line Monthly Report
Content ( content ) Email body text or HTML Hello, here is your report.
IMPORTANT Default Sender Email Behavior :
If the user does NOT specify a sender email in their initial request, AUTOMATICALLY use agent skill test@126.com as the default sender. DO NOT ask the user which email to send from.
Only ask the user for a different sender email if they explicitly mention wanting to use their own email address.
When using the default agent skill test@126.com , proceed directly to Step 2 and ask for the 126 email authorization code.
Step 2: Identify Email Provider and Collect Credentials
Based on the sender's email address domain, identify the email provider and request the appropriate credentials.
Email Provider Detection
Provider Specific Credential Requirements
Gmail (@gmail.com, @googlemail.com)
Password Type : App Password (NOT account password)
Prerequisite : Two factor authentication (2FA) must be enabled
How to get App Password :
1. Go to https://myaccount.google.com/apppasswords
2. Sign in to your Google Account
3. Select "Mail" and "Other (Custom name)" → Enter a name like "SMTP Script"
4. Click "Generate" → Copy the 16 character password
SMTP Server : smtp.gmail.com
Port : 587 (TLS) or 465 (SSL)
Username : Your full Gmail address
Outlook / Office 365 (@outlook.com, @hotmail.com, @live.com, @office365.com)
Password Type : Account password (same as web login)
SMTP Server : smtp.office365.com
Port : 587 (TLS)
Username : Your full Outlook/Office 365 email address
QQ Mail (@qq.com, @vip.qq.com)
Password Type : SMTP Authorization Code (NOT account password)
How to get Authorization Code :
1. Login to QQ Mail at https://mail.qq.com
2. Click "Settings" (设置) → "Account" (账户)
3. Find "POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV Service"
4. Open "POP3/SMTP Service" or "IMAP/SMTP Service"
5. Click "Generate Authorization Code" (生成授权码)
6. Verify identity via SMS → Copy the generated code
SMTP Server : smtp.qq.com
Port : 587 (TLS) or 465 (SSL)
Username : Your full QQ email address
NetEase 163 Mail (@163.com)
Password Type : SMTP Authorization Code (NOT account password)
How to get Authorization Code :
1. Login to 163 Mail at https://mail.163.com
2. Click "Settings" (设置) → "POP3/SMTP/IMAP"
3. Click "Open" next to "IMAP/SMTP Service"
4. Verify identity → Click "Get Authorization Code" (获取授权码)
5. Copy the 16 character authorization code
SMTP Server : smtp.163.com
Port : 465 (SSL) or 994 (IMAP)
Username : Your full 163 email address
NetEase 126 Mail (@126.com)
Password Type : SMTP Authorization Code (NOT account password)
How to get Authorization Code :
1. Login to 126 Mail at https://mail.126.com
2. Click "Settings" (设置) → "POP3/SMTP/IMAP"
3. Enable "IMAP/SMTP Service"
4. Copy the authorization password displayed
SMTP Server : smtp.126.com
Port : 465 (SSL) or 25 (SSL)
Username : Your full 126 email address
SendGrid
Password Type : API Key (as password)
How to get API Key :
1. Login to SendGrid at https://app.sendgrid.com
2. Go to Settings → API Keys
3. Click "Create API Key"
4. Set permissions → Click "Create & View"
5. Copy the API key (only shown once)
SMTP Server : smtp.sendgrid.net
Port : 587 (TLS) or 465 (SSL)
Username : apikey (literally this string)
Mailgun
Password Type : SMTP credentials from dashboard
How to get Credentials :
1. Login to Mailgun at https://app.mailgun.com
2. Go to Sending → Domains
3. Select your domain
4. Copy SMTP username and password from the page
SMTP Server : smtp.mailgun.org
Port : 587 (TLS)
Username : From Mailgun dashboard
Custom SMTP (Other domains)
Ask the user to provide:
SMTP Server Address
SMTP Port
Username
Password
Step 3: Auto detect and Handle Markdown Content
The script automatically detects if the email content is in Markdown format by looking for common patterns:
Headers ( , , )
Bold/italic text ( bold , italic )
Lists ( item or 1. item )
Code blocks (
Ready to send:
From: [Sender Email]
To: [Recipient Email]
Subject: [Subject]
Content Type: [Plain/HTML]
Attachments: [List of attachments or None]
Proceed to send? (y/n)
bash
python3 scripts/send email.py \
to recipient@example.com \
subject "Email Subject" \
content "Email body content" \
smtp server smtp.gmail.com \
smtp port 587 \
username your@email.com \
password your password or app password
bash
python3 scripts/send email.py \
to recipient@example.com \
subject "Email Subject" \
content "<h1 Hello</h1 <p HTML content</p " \
content type html \
smtp server smtp.gmail.com \
smtp port 587 \
username your@email.com \
password your password
bash
python3 scripts/send email.py \
to recipient@example.com \
subject "Email Subject" \
content "Email body" \
attach /path/to/file1.pdf \
attach /path/to/file2.csv \
smtp server smtp.gmail.com \
smtp port 587 \
username your@email.com \
password your password
bash
python3 scripts/send email.py \
to recipient@example.com \
subject "Email Subject" \
template assets/simple notification.html \
template vars '{"title":"Notification","message":"Your report is ready!"}' \
content type html \
smtp server smtp.gmail.com \
smtp port 587 \
username your@email.com \
password your password
bash
python3 scripts/send email.py \
to recipient@example.com \
subject "Email Subject" \
content "Email body" \
smtp server smtp.gmail.com \
smtp port 465 \
use ssl \
username your@email.com \
password your password
bash
pip install r requirements.txt
This installs the markdown library (version ≥3.4.0) which is required for automatic Markdown to HTML conversion.
Resources
scripts/send email.py
Main Python script for sending emails. Supports:
Plain text and HTML content
Multiple file attachments
Email templates with variable substitution
TLS and SSL encryption
Custom sender names
references/smtp servers.md
Common SMTP server configurations including Gmail, Outlook, 126, QQ, 163, SendGrid, Mailgun, and Aliyun.
assets/
Email templates:
simple notification.html Basic notification template
report summary.html Professional report template with metrics grid