'How to set up a postfix dummy smtp server in Travis-CI for use with a Phoenix app?
I am working on a Elixir/Phoenix app that uses Bamboo to send email using a server at 127.0.0.1:25. My TravisCI builds fail because of the lack of a SMTP server in the TravisCI environment. How can I set up the travis-yaml to install a postfix server and set it up to disable outgoing mail? So far I have the following in my travis-yaml:
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq postfix
Which successfully installs postfix, but now I need to figure out how to start it and disable outgoing mail, which I am having trouble figuring out how to do.
Solution 1:[1]
You can use Mailhog as a mock smtp server;
It provides SMTP server and UI. If you just want to send emails it'll be a great fit.
HOW TO:
before_install:
- go get github.com/mailhog/MailHog
- go install github.com/mailhog/MailHog
script:
- sudo $GOPATH/bin/MailHog &>/dev/null &
then connect to localhost:1025 for sending emails.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mehmet Gökalp |