Training code to use Nodemailer client with Express running on Docker
- NodeJS
- Docker
- Docker compose
- SMTP server
git clone https://github.com/sebastianaf/training-nodemailer
cd training-nodemailer
Create a .env
from .env.example
file in the root folder with all environment variables, this variables will be used by the containers, it need to be reached by docker-compose.yml
file.
It's recommend to change all the names (in docker-compose.yml
, Dockerfile
, package.json
and in this README.md
file) named with training
and nodemailer
with your own organization name and project name.
Uncomment the ports flag in docker-compose.yml
to be able for access the services.
docker compose -p training-nodemailer up -d
After type and run the command go to localhost:${API_PORT}
Try out this POST
query to localhost:${API_PORT}/email
{
"remitterName":"Nodemailer",
"logoURL":"https://i0.wp.com/community.nodemailer.com/wp-content/uploads/2015/10/n2-2.png",
"recieverEmails":["mail@yours.com"],
"title":"Notification 🔔",
"title":"What is Nodemailer?",
"subject":"📨 Email send from Nodemailer",
"body":"Nodemailer is a module for Node.js applications to allow easy as cake email sending. The project got started back in 2010 when there was no sane option to send email messages, today it is the solution most Node.js users turn to by default.<br><br><strong>Sincerely</strong><br>sebastianaf.",
"footer":"Nodemailer - Powered by EmailEngine",
"legal":"MIT License | Nodemailer"
}
That may looks like this.