January 2019
Intermediate to advanced
520 pages
14h 32m
English
Before we start our microservice, we need a working SMTP server. Let's create one with Docker. The following command creates a container with a Postfix server instance:
docker run -it --rm --name test-smtp -p 2525:25 \ -e SMTP_SERVER=smtp.example.com \ -e SMTP_USERNAME=admin@example.com \ -e SMTP_PASSWORD=password \ -e SERVER_HOSTNAME=smtp.example.com \ juanluisbaptiste/postfix
The server exposes port 25 and we remap it to local port 2525. The command sets all the necessary parameters using environment variables and now the mailer microservice is ready to compile and run. Do so using the cargo run command, and when it starts, check it using the following command:
curl -d "to=email@example.com&code=passcode" -X POST http://localhost:8002/send ...
Read now
Unlock full access