This project is built using HTML, CSS, JavaScript, PHP, and MySQL for storing the data.
The live demo link for the app: https://emaaail.herokuapp.com/index.php
- PHP 8 and above
- Google account
After cloning the repository you need to go to google scripts and create new project.
- In the newly created project now go to
code.gs
file and paste all the content fromemail/code.gs
file. - Also create two new files (
comic.html
andtoken.html
) and past their content in them. - Now deploy the project (create new web app) with the default setting (make sure to change the access to anyone if not anyone) after that copy the app url and add as environmental variable.
After that you need to configure environmental variables for the project.
Note: as I am using remotemysql as my database the database name and user are same for me; you can change this by going to configs/database.php
file.
DB_HOST=<your-database-host>
DB_PASSWORD=<your-database-password>
DB_USER=<your-database-user>
GOOGLE_APP_SCRIPT_URL=<your-google-app-script-url>
CRON_SECRET=<your-cron-secret> # you can set this value to any secret you like
assets
directory contains all the staticCSS
andJavaScript
file required by the projectcomponents
directory contains the UI components used in the projectconfigs
directory contains database configuration filesemail
directory contains the email templates and the google app script filesrc
directory contains the user and email classesindex.php
is the landing page of the projectabout.php
is the about page of the projectgetting-started.php
is the page where user enter their infotoken-verification.php
is the page for verifying the user's email address by using tokensuccess.php
is the page where user user reaches after successfully subscribing/unsubscribingcron.php
is used for sending comics to the subscribed users every 5 minutes. This page only accepts the get request which contains thesecret
as its parameter. If thesecret
and env variableCRON_SECRET
are same only then the emails are sent.
The reason why cron job is in the root dir is because I'm using cron-job.org; It makes a GET request to the project every 5 minutes and hence the emails are sent to the subscribed users
Run index.php
in your browser.
Google Apps Script only allows 100 emails per day so if the limit is exceeded please try again next day