Skip to content

tech-adarshjha/Email-Campaign-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Campaign Manager

Contains legacy code, update code and use this as reference.

A full-featured desktop and web application for managing, sending, and tracking email campaigns with email view tracking and unsubscribe management. Built with Electron + React for desktop and PHP for backend APIs.

Features

  • Campaign Management: Create, schedule, pause, and monitor email campaigns
  • Contact Lists: Organize contacts into mailing lists and groups
  • Email Composition: Rich-text editor with template variables for personalized emails
  • Tracking: Monitor email opens and click-throughs with automatic logging
  • Unsubscribe Handling: Automatic tracking and management of unsubscribe requests
  • File Attachments: Attach files to campaigns and merge individual files per recipient
  • Subscription Plans: Support for trial and paid tier limits (10 and 20 emails/day)
  • Mac Address Validation: Detect suspicious multi-device access attempts
  • Admin Dashboard: Manage users, subscriptions, and monitor campaigns

Architecture

server/         - PHP backend APIs and admin panel
├── api/        - API endpoints for client requests
├── src/        - Core functions (database, auth, user/subscription management)
└── dashboard.php - Admin control panel

whiz/           - Electron + React desktop application
├── public/     - Electron main process, email sending logic
├── src/        - React components and shared config
└── package.json- Dependencies and app metadata

Getting Started

Backend Setup

  1. Requirements:

    • PHP 7.0+
    • MySQL 5.7+
    • Node.js 12+ (for testing)
  2. Database Setup:

    CREATE DATABASE whiz;
  3. Configuration (use environment variables):

    export DB_HOST=localhost
    export DB_USER=root
    export DB_PASS=your_password
    export DB_NAME=whiz
    export ADMIN_EMAIL=admin@example.com
    export ADMIN_PASSWORD=your_secure_password
  4. Initialize Database Schema: Create tables for users, contacts, and campaigns (schema provided on request).

  5. Run PHP Server:

    cd server
    php -S localhost:8000

Desktop App Setup

  1. Install Dependencies:

    cd whiz
    npm install
  2. Configure API Endpoint (create/update .env file):

    REACT_APP_API_BASE_URL=http://localhost:8000/api
    REACT_APP_SUPPORT_EMAIL=support@example.com
    REACT_APP_APP_NAME=YourAppName
  3. Development Mode:

    npm run electron-dev
  4. Build for Production:

    npm run build
    npm run dist

Configuration

All sensitive and deployment-specific values use environment variables. Key variables:

Variable Default Purpose
DB_HOST localhost MySQL host
DB_USER root MySQL user
DB_PASS change-me MySQL password
DB_NAME whiz Database name
ADMIN_EMAIL admin@example.com Admin login email
ADMIN_PASSWORD change-me Admin login password
REACT_APP_API_BASE_URL http://localhost:8000/api Backend API endpoint
REACT_APP_SUPPORT_EMAIL support@example.com Support contact email
REACT_APP_APP_NAME Whiz Application display name

API Endpoints

All endpoints require proper authentication and respond with JSON. Key endpoints:

  • POST /api/verifyuser.php - Verify user email and subscription
  • POST /api/addmac.php - Register device MAC address
  • POST /api/getdata.php - Sync tracking and unsubscribe data
  • POST /api/uploadfile.php - Upload campaign attachments
  • GET /api/unsubscribe.php?u=USER_ID&c=CAMPAIGN_ID&e=EMAIL_ID - Handle unsubscribe
  • GET /api/getimage.php?u=USER_ID&c=CAMPAIGN_ID&e=EMAIL_ID - Track email opens

Database Schema Overview

users

  • id, email, plan (trial/paid), status (allowed/revoked/expired)
  • macid (comma-separated for multi-device detection)
  • track (JSON array of open events), unsub (JSON array of unsubscribe events)

contacts

  • id, email, subscribe (boolean), group (array)
  • Organized into custom mailing lists/groups

campaigns

  • id_, name, subject, emails (array of recipients)
  • status (draft/active/paused/done/later), template (final HTML)
  • Tracking and delivery metadata

Security Notes

⚠️ Important:

  1. Never commit credentials - Always use environment variables for secrets
  2. HTTPS in production - API endpoints must use HTTPS
  3. Validate input - All user input is validated server-side
  4. Database backups - Regularly back up your tracking data
  5. MAC validation - Prevents unauthorized multi-device access; adjust logic for your use case
  6. Admin credentials - Change default admin password immediately
  7. Email headers - Tracking pixels and unsubscribe links are automatically appended; ensure compliance with email regulations (CAN-SPAM, GDPR, etc.)

Development

Tech Stack

  • Frontend: React 16, react-uwp (Windows UWP design), ag-grid
  • Desktop: Electron 7, electron-db for local storage
  • Backend: PHP, MySQL, Nodemailer (for SMTP)
  • Build: Create React App, electron-builder

Project Structure

  • /whiz/src/components/ - React UI components
  • /whiz/src/config/appConfig.js - Centralized configuration
  • /whiz/public/electron.js - Electron main process & email sender
  • /server/api/ - REST API endpoints
  • /server/src/ - Shared backend functions

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit changes (git commit -am 'Add my feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a pull request

Troubleshooting

"Database connection failed"

  • Check DB_HOST, DB_USER, DB_PASS environment variables
  • Verify MySQL is running
  • Ensure the database exists

"Email sending fails"

  • Verify SMTP settings in the app (host, port, SSL)
  • Check email account credentials
  • Verify daily send limit hasn't been reached

"Tracking not working"

  • Confirm server APIs are running
  • Check firewall/proxy blocking tracking requests
  • Verify REACT_APP_API_BASE_URL is correct

License

This project is provided as-is. Modify and use according to your needs.


Last Updated: December 2025

About

A full-featured desktop and web application for managing, sending, and tracking email campaigns with email view tracking and unsubscribe management. Built with Electron + React for desktop and PHP for backend APIs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors