- Create an A Record for 'mail' that point to the VM ip
- Create an MX Record that points @ to mail.[sitename.TLD]
Confirm proper routing using:
dig mail.[sitename.TLD]
Open ports 25 (SMTP) and 110 (POP3) in the Network Security Group for your VM
Run ifconfig
and take note of 'inet addr:' value for eth0 interface
Install Exim:
apt-get install exim4-daemon-heavy
Configure Exim:
sudo dpkg-reconfigure exim4-config
Select 'internet site; mail is sent and received directly using SMTP
Leave 'System Mail Name' as default value
For ip address to listen on for SMTP connections, supply the ip obtained from running ifcongig (this is usually a 10.\*.\*.\*)
For destinations where mail is accepted supply [sitename.TLD]
Leave domains to relay for empty, also leave machines to relay for empty.
Select No for 'Keep DNS queries minimal'.
Select 'Maildir format in home directory'
Select 'Split configuration into small files'
For 'root and postmaster mail recipient' choose a valid [user]
Beware that most ISPs block outbound traffic on port 25 unless you specifically call and ask to remove this limitation. For this reason, be sure that you test remote SMTP connection from a machine that has outbound access to port 25.
From another machine with outbound access to port 25:
telnet mail.bipbopbeep.com 25
Verify that you have successfully connected
IF YES, send an email to [user]@[sitename.TLD]
Check for mail in ~/Maildir/new and verify receipt
Edit the /etc/exim4/exim4.conf.template file to add a new router, add the following below the section 'begin routers'
catchall_pub:
driver = redirect
domains = [sitename.TLD]
data = [user]@[sitename.TLD]
sudo apt install dovecot-imapd dovecot-pop3d
Edit /etc/dovecot/conf.d/10-mail.conf and change the following line:
mail_location = mbox:~/mail:INBOX=/var/mail/%u
to
mail_location = maildir:~/Maildir
Enable plaintext auth:
Uncomment
disable_plaintext_auth = yes
in '/etc/dovecot/conf.d/10-auth.conf'
and set to
`disable_plaintext_auth = no
Restart Dovecot
sudo systemctl restart dovecot.service