PhantomMail is a Python application designed to generate and send realistic transport-related emails using advanced AI technology. It leverages Google's Gemini 2.0 Flash model for content generation and Resend for reliable email delivery. The application can automatically generate PDF attachments for documents like customs declarations, making the emails even more realistic and comprehensive.
The application can generate four distinct types of transport-related emails:
- Transport Orders: Creates realistic shipping orders with detailed pickup/delivery information
- Customs Declarations: Generates comprehensive customs documentation with attachments
- Customer Inquiries: Produces natural-sounding questions about shipments
- Complaint Emails: Creates authentic-looking customer complaints
The application is built with LangGraph, a framework for building and running graphs of computations.
- Generates realistic transport order data
- Creates convincing email content using Gemini 2.0 Flash
- Converts email content to HTML format
- Sends emails via Resend
- Supports multiple writing styles and languages
- Clone the repository
- Install dependencies using UV:
uv syncTo ensure code quality, install pre-commit hooks by running the following commands:
-
Set Up Git Hooks:
pre-commit install
This will ensure the hooks run automatically before you commit any changes.
-
Run Hooks on All Files (Optional):
pre-commit run --all-files
Use this command to apply the hooks across the entire codebase if you're contributing for the first time or after changes to the pre-commit config.
Notes
- Make sure to run these commands after cloning the repository.
- For more details, refer to pre-commit documentation.
Create a .env.local file in the root directory with the following variables:
RESEND_API_KEY= # Get from https://resend.com
GOOGLE_API_KEY= # Your Google API key for Gemini
SENDER_EMAIL= # Email address to send from
LANGCHAIN_TRACING_V2=true
LANGCHAIN_API_KEY= # Optional: For LangChain debugging
LANGCHAIN_PROJECT=phantommailRun the application using UV:
uv run phantommailThe application will:
- Prompt you for a recipient email address
- Generate a fake transport order
- Create an email using Gemini AI
- Convert the content to HTML
- Send the email via Resend
src/phantommail/main.py: Entry point and email recipient handlingsrc/phantommail/graphs/: LangGraph implementationstate.py: State management for the email generation pipelinenodes.py: Graph nodes for data generation, email creation, and sending
- LangChain
- LangGraph
- Google Generative AI (Gemini Flash 2.0)
- Resend
- Python-dotenv
- Create an account at https://resend.com
- Get your API key from the dashboard
- Add the API key to your
.env.localfile
Just the the following command (UV) to launch a local LangGraph server, it will open a LangGraph Studio UI for debugging the flow:
uvx --refresh --from "langgraph-cli[inmem]" --with-editable . --python 3.13 langgraph devPlease check out the offical LangGraph documentation located here.
Clone this repository, then login to LangSmith and deploy the project from there: https://langchain-ai.github.io/langgraph/cloud/quick_start/
MIT

