The Smart Mailer Program is a C++ application that sends emails to recipients listed in a CSV file using SMTP services. It supports customizable email bodies, placeholder replacements, and includes tracking functionality to monitor email opens through a 1x1 pixel image hosted on a server. Designed to run on Linux, this program introduces delays between emails to avoid spam detection and generates a detailed report grouped by department codes.
- Department-Based Filtering: Send emails to specific departments or all recipients in the list.
- Placeholder Replacement: Replace placeholders like
#name#and#department#with recipient-specific values in the email body. - HTML Email Support: Supports rich email bodies in HTML format.
- Email Open Tracking: Includes a transparent 1x1 pixel image in emails to track how many recipients opened the mail.
- Report Generation: Generates a report showing the number of emails sent, grouped by department code.
- Cross-Platform GUI/CUI Support: The program provides a clean Command-Line Interface (CUI) for Linux systems.
A Nix shell configuration is provided for setting up a consistent development environment.
To enter the shell, run:
nix-shellThis will install and set up the following dependencies in an isolated environment:
- openssl: For secure SMTP connections.
- boost: C++ libraries for program execution.
- gcc: C++ compiler.
- python3: For running auxiliary scripts.
- flask: Python library for running the pixel tracking server.
- python-dotenv: To manage environment variables.
Docker Compose is provided to containerize the Pixel Tracking Server and a Backend API for easier deployment.
Run the following command to start all services:
docker-compose upThis will:
- Deploy the Pixel Tracking Server at
pixel.chunyu.sh(Port 8080). - Deploy the Backend API at
mailer.chunyu.sh(Port 5000). - Set up Traefik as a reverse proxy for routing and securing requests with TLS.
- Organize all services into a private Docker network
intranet.
The smart_mailer requires gcc, boost, and openssl
sudo dnf install gcc-c++ boost-devel openssl-develsudo apt-get update
sudo apt-get install build-essential libboost-all-dev libssl-devFor the smart_mailer to work, some environment variables need to be set. Follow env.example to set the required environment variables.
cp env.example .envPython dependencies can be installed using pip. The Makefile will install the required dependencies.
make install_python_depsTo build the smart_mailer program, run:
make
make runTo start the pixel tracking server, run:
python pixel_server.pyTo clean up the build files, run:
make clean