Skip to content

Let instances send emails

cloud-init will install and configure dma to send emails to a relayhost, namely our mail.raksha.ch.

On every configured instance, the resulting files should be as follows (for a hypothetical mars.exo.vps.flosstools.org server`:

  • /etc/mailname
mars.exo.vps.flosstools.org
  • /etc/dma/dma.conf
root@hublot:/home/debian# cat /etc/dma/dma.conf 
SMARTHOST mail.raksha.ch
PORT 465
SECURETRANSFER
AUTHPATH /etc/dma/auth.conf
MAILNAME /etc/mailname
MASQUERADE infrastructure+mars.exo.vps.flosstools.org@mail.raksha.ch
  • /etc/dma/auth.conf
infrastructure@mail.raksha.ch|mail.raksha.ch:xx-to-fill

As you see, you need a token for the infrastructure@mail.raksha.ch user. Head to mail.raksha.ch webinterface in a private browsing tab, login as that user and get an authentication token. If possible, enter the "outgoing" IPv4 and IPv6 as authorized IPs (comma-separated), then edit the /etc/dma/auth.conf file in the given instances.

Test email sending with bsd-mailx's mail program:

echo "Test email content" | mail -s "Test email from mars.exo.vps.flosstools.org" me@example.com

This should appear in the specified inbox correctly after (very few) seconds.