This server is used for sending emails from the Classifyer app's contact form, hosted on Heroku.
Follow these instructions:
- Clone this repository
- Run
npm installto install all the dependencies - Create a Heroku account here and create a free instance.
- Install the Heroku CLI.
- Run the following commands inside the project root:
heroku login heroku git:remote -a classifyer-email-server - Configure the server by adding the following config variables (either through Heroku dashboard or by running the Heroku CLI config command):
MAIL_HOST: Your mail server hostMAIL_PORT: Your mail server portMAIL_USER: Your mail server username (usually your email)MAIL_PASS: Your mail server passwordMAIL_FROM: The sender emailMAIL_TO: The receiver email addressFRONTEND_ORIGIN: The frontend app origin to allow with CORS
- Generate a Service Account certificate from the Firebase account used with the Classifyer web app and store it at
/firebase.cert.json. - Run
npm run deployto deploy the server. It should be up and running after a few seconds.NOTE: This process will wipeout all uncommitted work! Make sure you have committed all files before running this script.
- Don't forget to add the email server's URL in the Classifyer web app.
This server creates the following RESTful API:
- Endpoint:
/send - Method:
POST - Headers:
Content-Type: application/json - Body:
{ "name": "string", "email": "string", "reason": "string", "subject": "string", "time": "number", "message": "string" }