current version: 0.5.0
A service to send emails from applications from a microservices cluster.
The service takes all emails compatibile with the Nodemailer specification. To see the full Email object, go to API docs.
- Swagger API spec causes clients generated by Swagger Codegen CLI to not work with the API. Please use the AMQP protocol (RabbitMQ) to connect to the application.
First we need to create .env
file. You can copy the .env.example
file.
To start the service (mailer-service) we neeed RabbitMQ and MongoDB instances. You can setup your own local servers or you can use the docker-compose.yml
images (recommended).
Dev ::
npm start
Prod ::
npm run prod
npm test
npm run lint
In the .env
file add your smtp settings. When using the Nodemailer well-known-services option, set up the MAILER_SERVICE variable, provide the MAILER_USER and MAILER_PASSWORD. That's all. When using normal SMTP connection, provide all the MAIL ENVS except the MAILER_SERVICE.
All the options are equal to the Nodemailer transport options:
- MAILER_HOST -> host
- MAILER_PORT -> port
- MAILER_USER -> auth.user
- MAILER_PASSWORD -> auth.pass
- MAILER_SECURE -> secure
- MAILER_SERVICE -> service
For more info refer to the Nodemailer docs.
We need to provide connection configuration for Mongo in the .env
file. When connecting from inside docker compose (running all 3 services on docker), set mailer_mongo_db
(the mongo container name) as the host.
We need to provide connection configuration for Rabbit in the .env
file. When connecting from inside docker compose (running all 3 services on docker), set rabbit_mq
(the rabbitmq container name) as the host.