Sending E-mails
Environment Variables
MAIL_URL: The server reads from the MAIL_URL environment variable to determine how to send mail. The MAIL_URL should reference an SMTP server and use the form:
smtp://USERNAME:PASSWORD@HOST:PORT
or
smtps://USERNAME:PASSWORD@HOST:PORT
The smtps:// form (the s is for “secure”) should be used if the mail server requires TLS/SSL (and does not use STARTTLS) and is most common on port 465. Connections which start unencrypted prior to being upgraded to TLS/SSL (using STARTTLS) typically use port 587 (and sometimes 25) and should use smtp://. For more information see the Nodemailer docs
Docker Setup
The MAIL_URL can be passed to Docker with the -e parameter:
docker run --name titra -p 3000:3000 --link mongodb -e MONGO_URL=mongodb://mongodb/titra -e ROOT_URL=http://localhost:3000 -e MAIL_URL=smtp://USERNAME:PASSWORD@HOST:PORT kromit/titra
It can also be added in a similar way with docker-compose:
version: '3'
services:
titra:
image: kromit/titra
container_name: titra_app
depends_on:
- mongodb
environment:
- ROOT_URL=${ROOT_URL}
- MONGO_URL=mongodb://mongodb/titra?directConnection=true
- PORT=3000
- MAIL_RUL=MAIL_URL=smtp://USERNAME:PASSWORD@HOST:PORT
ports:
- "3000:3000"
restart: always
mongodb:
image: mongo:5.0
container_name: titra_db
restart: always
environment:
- MONGO_DB:titra
volumes:
- titra_db_volume:/data/db
volumes:
titra_db_volume: