Editor Tutorial
Welcome to the sendMail Editor tutorial. This guide covers how to use the standalone WYSIWYG newsletter editor to create, edit, and manage HTML newsletters.
Getting Started
Prerequisites
Python 3.10 or later
PyQt6 and PyQt6-WebEngine installed
sendMail package installed
Installation
If you haven’t installed sendMail yet:
pip install sendMail
Or from source:
git clone https://github.com/xmayeur/mailing.git
cd mailing
pip install -e .
Launching the Editor
From Command Line
Launch a blank editor:
python src/editor.py
Open an existing file:
python src/editor.py path/to/your/newsletter.md
python src/editor.py path/to/your/newsletter.html
Using the Standalone Binary (macOS/Windows)
If you’ve built the PyInstaller executable:
./dist/sendMailEditor.app/Contents/MacOS/sendMailEditor
./dist/sendMailEditor/sendMailEditor.exe
Opening Existing Documents
The editor supports both Markdown and HTML:
# Open a Markdown file
python src/editor.py newsletters/2026-05-17.md
# Open an HTML file
python src/editor.py newsletters/template.html
When you open a file, the editor automatically detects the format and displays it in the rich text editor.
Editing Content
Text Formatting
Use the Quill editor toolbar to format text:
Emphasis: Select text and click Bold (B) or Italic (I)
Headings: Select text and choose heading size from dropdown
Lists: Click the bullet list or number list button
Links: Select text, click the link button, enter URL
Images: Click the image button and choose from your computer
Inserting Images
Click the image button in the toolbar
Select an image from your computer
The image is automatically embedded as base64 for HTML export
HTML Preview
The editor shows a live preview of the generated HTML. This helps you see how the newsletter will look when sent.
Working with Filters
The editor includes advanced filtering capabilities for conditional content delivery.
Opening the Send Dialog
Click File → Send or use Ctrl+S (or Cmd+S on macOS)
This opens the Send Dialog with filter options
The dialog shows your current sendMail profiles
Setting Up Filters
In the Filters section, enter YAML syntax:
country: USA subscription_level: premium
Click Apply Filter to activate the filter
The editor validates the filter syntax in real-time
A visual indicator shows if the filter is valid (green) or invalid (red)
Database Preview
Select a subscriber database (CSV or Google Sheets)
Click Load Database to preview records
The editor shows matching records based on your filter
See exactly which subscribers will receive the filtered content
Valid Filter Fields
Filter fields depend on your subscriber database schema. Common fields include:
countryemailsubscription_levelnameCustom fields from your CSV/Google Sheets
Managing Profiles
Adding sendMail Profiles
The editor reads profiles from your config.yml:
profiles:
newsletter:
smtp_server: smtp.gmail.com
from_address: newsletters@example.com
rate_limit: 100
Selecting a Profile
Open the Send Dialog (File → Send)
The Profile dropdown shows all available profiles
Select the profile to use for sending
The filter fields are validated against that profile’s database
Profile Configuration
Profiles are managed in your sendMail configuration file:
# Edit your configuration
python src/editor.py
# Then: File → Settings
Saving Your Work
The editor automatically saves your content in two formats:
Markdown Format
The native format for storing content. Includes:
Human-readable text formatting
Preserved structure (headings, lists, etc.)
Easy version control in Git
HTML Format
The format used for sending emails. Includes:
Rendered HTML markup
Embedded images as base64
Styling and formatting preserved
Save Behavior
When you edit a document, both formats are updated:
New documents: Saved with your chosen filename:
python src/editor.py newsletters/my-newsletter.md
# Creates: newsletters/my-newsletter.md (Markdown)
# newsletters/my-newsletter.html (HTML)
Existing documents: Updated in place:
# Both .md and .html files are updated
Manual Save
Use File → Save (Ctrl+S / Cmd+S) to explicitly save changes.
Sending via sendMail
Once your newsletter is ready:
Save the newsletter in the editor
Note the HTML file path (e.g.,
newsletters/2026-05-17.html)Send via sendMail:
python src/sendMail.py --profile newsletter \ -s "May Newsletter 2026" \ newsletters/2026-05-17.html
With Filters
Apply the same filter used in the editor:
python src/sendMail.py --profile newsletter \
-s "Premium Subscribers Newsletter" \
-f 'subscription_level: premium' \
newsletters/2026-05-17.html
Using Database Preview Filter
Set up filter in editor
Copy the filter from the editor
Use the same filter in sendMail command
Tips and Tricks
Templates
Create reusable newsletter templates:
# Save as a template
python src/editor.py templates/base-newsletter.md
# Create new newsletter from template
cp templates/base-newsletter.md newsletters/2026-05-20.md
python src/editor.py newsletters/2026-05-20.md
Batch Processing
For recurring newsletters:
# Create a weekly newsletter
python src/editor.py newsletters/weekly-$(date +%Y-%m-%d).md
# Send when ready
python src/sendMail.py --profile newsletter \
-s "Weekly Update" \
newsletters/weekly-$(date +%Y-%m-%d).html
Filter Testing
Before sending to your full list:
Create a test filter in the editor
Use database preview to see matching records
Test with a small group first:
python src/sendMail.py --profile newsletter \ -s "Test Newsletter" \ -f 'test_user: true' \ -t \ newsletters/test.html
Image Best Practices
Size appropriately: Compress images before inserting
Alt text: Always provide alt text for accessibility
Responsive: The editor scales images to fit email widths
Test rendering: Preview in the HTML pane before sending
Markdown Tips
The editor supports full GitHub-flavored Markdown:
Tables
Code blocks with syntax highlighting
Links and references
Inline HTML (for advanced formatting)
Google Sheets Integration
To use Google Sheets for subscriber lists:
Set up Google Sheets credentials in sendMail config
In the editor, select your Google Sheets database
Use database preview to verify filters work correctly
Common Tasks
Send to Filtered Group
# 1. Create newsletter
python src/editor.py newsletters/premium-offer.md
# 2. Set up filter in editor
# Filter: subscription_level: premium
# 3. Test with preview
# (Verify matching records in database preview)
# 4. Send to filtered group
python src/sendMail.py --profile default \
-s "Exclusive Premium Offer" \
-f 'subscription_level: premium' \
newsletters/premium-offer.html
Troubleshooting
Editor Won’t Launch
Verify PyQt6 is installed:
pip install PyQt6 PyQt6-WebEngineCheck Python version:
python --version(requires 3.10+)On Linux without display: Use xvfb or set
QT_QPA_PLATFORM=offscreen
Filter Not Validating
Check YAML syntax (proper indentation with spaces, not tabs)
Ensure field names match your database schema
Look for validation error message in red
Images Not Embedding
Check image file path is correct
Large images may be scaled down for email compatibility
Some email clients strip images - always provide alt text
sendMail Command Not Found
Ensure sendMail is installed:
pip install sendMailOr use full path:
python src/sendMail.py