Convert HTTP traffic into a Simple Email
- Clone the repository
git clone https://github.com/Dyoniso/XV1-Email-API
- Inside repository, run npm start
npm start .
In order to be able to send e-mail, configure the .env file with the credentials of your e-mail server.
#API
X_API_KEY='your_key' #Access API
#HTTP SERVER
HTTP_HOST = localhost #Server Host
HTTP_PORT = 8081 #Server Port
#SMTP SERVER
SMTP_SERVICE = 'EMAIL-SERVICE' #ex: GMAIL
SMTP_LOGIN = 'SMTP-LOGIN'
SMTP_PASSWORD = 'SMTP-PASSWORD'
SMTP_SECURE = off #SSL? ON or OFF
SMTP_PORT = 'SMTP-PORT'
SMTP_SENDER_EMAIL = 'EMAIL OF SEND' #[email protected]
With the API running, make a POST request at the following path: /mail/send
put the following parameters in the body.
{
"receiver":"[email protected]",
"subject":"Awesome email written in Node",
"text":"Very easy!",
"html":"<h1> Strong Email </h1>"
}
With everything finished, the receiver
will receive an email in the inbox.
Happy hacking!