{"id":17051632,"url":"https://github.com/auscay/automated-email","last_synced_at":"2026-04-18T01:36:10.588Z","repository":{"id":257162384,"uuid":"857155531","full_name":"auscay/Automated-Email","owner":"auscay","description":"This app allows users to schedule emails to be sent at future dates and times using PHP and MySQL.","archived":false,"fork":false,"pushed_at":"2024-09-17T20:33:53.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T23:35:39.102Z","etag":null,"topics":["cronjob","mysql","php","phpdotenv","phpmailer"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auscay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-13T23:28:17.000Z","updated_at":"2024-09-17T20:33:56.000Z","dependencies_parsed_at":"2025-07-03T23:33:39.287Z","dependency_job_id":"d7d9d2a5-42fe-4ef1-900e-398508497d51","html_url":"https://github.com/auscay/Automated-Email","commit_stats":null,"previous_names":["auscay/automated-email"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/auscay/Automated-Email","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auscay%2FAutomated-Email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auscay%2FAutomated-Email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auscay%2FAutomated-Email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auscay%2FAutomated-Email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auscay","download_url":"https://codeload.github.com/auscay/Automated-Email/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auscay%2FAutomated-Email/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745482,"owners_count":24813502,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cronjob","mysql","php","phpdotenv","phpmailer"],"created_at":"2024-10-14T10:06:50.849Z","updated_at":"2026-04-18T01:36:10.507Z","avatar_url":"https://github.com/auscay.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Email Scheduling and Notification System\n\nThis project is a simple **Email Scheduling and Notification System** built using **PHP**, **MySQL**, and **PHPMailer**. Users can schedule emails to be sent at a future date and time. The system checks for pending emails periodically using a cron job and sends them automatically.\n\n## Features\n\n- **User Authentication**: Users can sign up, log in, and access a personalized dashboard.\n- **Email Scheduling**: Users can schedule emails to be sent at a specific future date and time.\n- **Automated Email Sending**: A cron job checks the database every minute for pending emails and sends them using PHPMailer.\n- **Failed Emails Handling**: The system retries failed emails and logs the status of each email.\n- **PHP Sessions**: Protects certain pages (like the dashboard) by ensuring only logged-in users can access them.\n\n## Prerequisites\n\nBefore running the project, make sure you have the following installed:\n\n- PHP (\u003e=7.3)\n- MySQL\n- Composer (for dependency management)\n- PHPMailer (installed via Composer)\n\n## Installation\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/yourusername/email-scheduling-app.git\ncd email-scheduling-app\n\n```\n### 2. Install Dependencies\n\n#### Make sure you have Composer installed, then run:\n\n```bash\ncomposer install\n```\n#### This will install PHPMailer and other dependencies.\n\n### 3. Create the .env File\n\n#### Create a .env file in the project root and define your sensitive configurations:\n\n```bash\nDB_HOST=your_db_host\nDB_NAME=your_db_name\nDB_USER=your_db_user\nDB_PASSWORD=your_db_password\n\nSMTP_HOST=smtp.yourmailprovider.com\nSMTP_PORT=587\nSMTP_USER=your_email@domain.com\nSMTP_PASS=your_email_password\n```\n### 4. Setup the Database\n\n#### Create the MySQL database and import the SQL schema:\n\n```sql\nCREATE DATABASE email_scheduler;\nUSE email_scheduler;\n\nCREATE TABLE users (\n  id INT AUTO_INCREMENT PRIMARY KEY,\n  username VARCHAR(255) NOT NULL,\n  email VARCHAR(255) NOT NULL,\n  password VARCHAR(255) NOT NULL\n);\n\nCREATE TABLE scheduled_emails (\n  email_id INT AUTO_INCREMENT PRIMARY KEY,\n  recipient_email VARCHAR(255) NOT NULL,\n  subject VARCHAR(255) NOT NULL,\n  body TEXT NOT NULL,\n  scheduled_time DATETIME NOT NULL,\n  status ENUM('pending', 'sent', 'failed') DEFAULT 'pending',\n  attempts INT DEFAULT 0\n);\n```\n### 5. Configure Database Connection\n\n#### Edit the config/db.php file to load the environment variables using the vlucas/phpdotenv package.\n\n```php\n\u003c?php\nrequire_once __DIR__ . '/../vendor/autoload.php';\n\nuse Dotenv\\Dotenv;\n$dotenv = Dotenv::createImmutable(__DIR__ . '/../');\n$dotenv-\u003eload();\n\nclass Dbh {\n    protected function connect() {\n        $dsn = 'mysql:host=' . $_ENV['DB_HOST'] . ';dbname=' . $_ENV['DB_NAME'];\n        try {\n            $pdo = new PDO($dsn, $_ENV['DB_USER'], $_ENV['DB_PASSWORD']);\n            $pdo-\u003esetAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n            return $pdo;\n        } catch (PDOException $e) {\n            die('Connection failed: ' . $e-\u003egetMessage());\n        }\n    }\n}\n```\n### 6. Run the Application\n#### Serve the PHP application locally (or on your preferred server). If using PHP’s built-in server, run:\n\n```bash\nphp -S localhost:8000\n```\n#### Then, open http://localhost:8000 in your browser.\n\n### 7. Setup Cron Job for Email Sending\n\n##### Set up a cron job to run every minute to process scheduled emails:\n\n###### 1. Open the crontab editor:\n```bash\ncrontab -e\n```\n###### 2. Add the following line to execute the email sending script every minute:\n```bash\n* * * * * /usr/bin/php /path/to/project/includes/send_email.inc.php\n```\n##### Make sure the path to your PHP binary and project directory is correct.\n\n## Usage\n\n- **Sign up:** Create an account on the signup page.\n- **Login:** Log in to your account and access the dashboard.\n- **Schedule an Email:** Enter the recipient's email, subject, body, and scheduled time.\n- **View Scheduled Emails:** Check the dashboard for a list of all scheduled and sent emails.\n- **Automated Sending:** The system will automatically send emails when their scheduled time is reached.\n\n## File Structure\n```bash\nproject-root/\n│\n├── .env\n├── .gitignore\n├── composer.json\n├── composer.lock\n├── config.php\n├── index.php\n├── project.sql\n├── README.md\n│\n├── config/\n│   └── db.php\n│\n├── controllers/\n│   ├── login-contr.php\n│   ├── schedule_email-contr.php\n│   └── signup-contr.php\n│\n├── includes/\n│   ├── login.inc.php\n│   ├── logout.inc.php\n│   ├── schedule_email.inc.php\n│   ├── send_email.inc.php\n│   └── signup.inc.php\n│\n├── models/\n│   ├── login-model.php\n│   ├── schedule_email-model.php\n│   └── signup-model.php\n│\n├── cron/\n│   └── send_email.php\n│\n└── views/\n    ├── dashboard.php\n    ├── login.php\n    ├── schedule_email.php\n    └── signup.php\n\n```\n\n## Future Enhancements\n- Add functionality for recurring email schedules.\n- Implement a more robust error logging mechanism.\n- Implement email templates for better customization.\n\n## Technologies Used\n- **PHP:** Backend language\n- **MySQL:** Database to store users and email schedules\n- **PHPMailer:** To handle email sending\n- **Composer:** PHP dependency management\n- **Dotenv:** For managing environment variable\n\n## Contributions\nContributions are welcome! Feel free to submit a pull request or open an issue.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauscay%2Fautomated-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauscay%2Fautomated-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauscay%2Fautomated-email/lists"}