The Simple Mail Server has been made to easily add a contact functionality to a front-end project. Feel free to use and modify it as you please.
We assume that you have node.js installed on your machine. If that is not the case, refer to nodejs.org.
# clone the repository
git clone https://github.com/Nootaku/simplemailserver.git
# install node dependencies
npm install
# create a .env file
touch .env
Inside the .env
file paste and adapt the following variables:
Please refer to the node.js documentation for more info on how to use environment variables.
MAILSERVER_HOST=your.email.provider.host
MAILSERVER_USERNAME=john.doe@sending_email.com
MAILSERVER_PSW=password_for_john.doe@sending_email.com
MAILSERVER_DESTINATIONEMAIL=jane.doe@receiving_email.com
node -r dotenv/config index.js
The code of this repository has been built with a contact-form for professional purposes in mind. It is expected that the frontend form will send the following fields:
- name
- company
- message
The capcha (anti-spam) is also handled on the frontend.
If you want to change the form structure, don't forget to adapt the checkRequest()
function accordingly.
You can also change the content and style of the email by adapting the composeMail()
function.
We added a Dockerfile
to the project. You can create your own image with the following command.
Don't forget to change the tags according to your preferences
docker build -t simplemailserver:latest .
docker run -p 3002:3002 --env-file .env simplemailserver:latest