Skip to content

Instantly share code, notes, and snippets.

@toolboc
Created October 6, 2017 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toolboc/4444e3613892083327d65e2510ee6ba4 to your computer and use it in GitHub Desktop.
Save toolboc/4444e3613892083327d65e2510ee6ba4 to your computer and use it in GitHub Desktop.
Exim_and_Dovecot_On_Ubuntu_On_Azure.md

Exim and Dovecot on Ubuntu on Azure

Create MX Record in DNS

  • 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]

Install and Configure Exim

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]

Testing the initial Exim configuration

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

Optional configuring a catch-all router form email to *.[sitename.TLD]

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]

Installing and Configuring Dovecot for POP3 access

  • 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

Follow instructions to add POP3 account for your mail service

https://support.google.com/mail/answer/21289?hl=en

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment