AI-assisted workflow for drafting and sending JSON-defined emails via any SMTP-friendly mailbox (Google Workspace, Outlook, Namecheap, Proton, etc.).
Provide a minimal tool that lets me (or anyone using VS Code) draft emails as JSON, preview AI-upgraded wording directly in the terminal, and send the final version through my existing SMTP inbox without bouncing between multiple apps.
Fast, consistent emails: every message is polished with OpenAI, logged, and sent in both plain text and HTML with your signature. Originally a personal tool, it's now open source for recruiters, artists, and freelancers, and will soon plug into a larger "Career Assistant" suite for research, lead discovery, email lookup, and personalized outreach.
- Create and activate a Python 3.10+ virtual environment.
- Install dependencies:
pip install -r requirements.txt
- Copy
.env.exampleto.envand fill in:OPENAI_API_KEY- SMTP settings for the mailbox you want to send from (host, port, username, password, sender email, SSL/TLS preference). The script only needs standard SMTP auth, so bring credentials from whichever provider you use.
Place a JSON file in emails/ (or pass a custom path) with this structure:
{
"email": "recipient@example.com",
"subject": "Checking in",
"text": "Original text you want the model to improve.",
"prompt": "Structure this email"
}Fields:
email(required unless you pass--first/--last/--domain): recipient address.text(required): raw message the model should polish.subject(optional): defaults to "Quick update".prompt(optional): supply a custom instruction for the rewrite (tone, length, etc.). If omitted, the global default prompt is used.
python send_email.py --name sampleIf --name is omitted, the script asks "Which email JSON should I send?" and looks for <name>.json in ./emails.
Workflow:
- Loads the JSON.
- Sends the
text(plussubject/promptwhen provided) to the OpenAI model for improvement. - Displays the upgraded body text (with your signature appended) and asks for confirmation.
- On approval, sends a multi-part email (plain text + HTML). The HTML version includes your signature styling.
- Logs the status to
logs/email.log.
You can generate a cloud of likely inboxes from a first name, last name, and company domain (mirroring common linkedin2username patterns) and send the same email to each guess. Omit email from your JSON and run:
python send_email.py --name sample --first "Michael" --last "Clark" --domain example.comThe script derives addresses such as michael.clark@example.com, mclark@example.com, michaelc@example.com, clarkm@example.com, etc., shows the full list, and asks for approval before sending to each address individually.
Configure .env to set:
EMAIL_SIGNATURE: plain-text version (use\nfor line breaks in the env file).EMAIL_SIGNATURE_HTML_FILE(recommended): path to an HTML snippet (relative paths resolve from the project root). Start fromtemplates/signature_example.html, copy it totemplates/signature.html, and adjust as needed--templates/signature.htmlis gitignored so your personal branding stays local.EMAIL_SIGNATURE_HTML(optional): direct inline HTML override if you prefer keeping the snippet inside the env file. If both are supplied, the file takes precedence.
Use the log file to audit what was sent (success/failure + source JSON).
Note: Every email body is rewritten by the OpenAI model before sending. Review the AI-modified text carefully at the confirmation step to ensure it reflects exactly what you intend to say.