Mail Server Setup

Project Overview

This project gave me multiple opportunities to expand my troubleshooting and problem-solving abilities. I used Dovecot for IMAP and Postfix for SMTP. This DigitalOcean walkthrough is a good starting point for anyone interested in a similar project however, you may requires additional resources: HERE.

Disclaimer: Some VPS providers block SMTP ports by default. I recommend researching your VPS provider before starting this project and contacting them if necessary.

DNS Setup

I began this project by configuring my DNS setting up PTR, MX, and TXT records with SPF, DMARC, and DKIM. Proper DNS configuration is critical for a functioning mail server. I validated my DNS records and mail server health with a screen shot from MX toolbox listed below. It passed all checks with the 2 warnings seen in the image below involving SOA serial numbers which due to my domain provider are out of my control.

Mail Server Health Check Screenshot

Configuration & Troubleshooting

During setup, I encountered multiple errors that I was able to troubleshoot and work through. The first error appeared when connecting my mail server to an email client. I decided the best method to find the root of the problem would be to monitor the logs in real time using tail -F mail.log mail.err, which revealed that the problem was related to my configuration in Postfix of SMTP relay and recipient restrictions.

After resolving that, I ran into issues with the IMAP connection. Research led me to a helpful resource on outdated IMAP mail plugins providing a solution to my problem the source is linked: HERE.

Original Dovecot configuration:

protocol imap {
    mail_plugins = " autocreate"
}
plugin {
    autocreate = Trash
    autocreate2 = Sent
    autosubscribe = Trash
    autosubscribe2 = Sent
}

Updated configuration:

namespace inbox {
    inbox = yes

    mailbox Trash {
        auto = subscribe # autocreate and autosubscribe the Trash mailbox
        special_use = \Trash
    }
    mailbox Sent {
        auto = subscribe # autocreate and autosubscribe the Sent mailbox
        special_use = \Sent
    }
}

Even after updating the configuration, connection errors persisted. I manually connected via OpenSSL to the IMAP and SMTP ports and attempted to authenticate to the services. this allowed me to confirm that IMAP had been successfully configured and hypothesize potential points of error due to Postfix rejecting my OpenSSL Auth. I considered potential points of failure and with further research I found a helpful source allowing me to resolve my issue with SSL and secure authentication to Postfix the source is linked: HERE. Following it resolved the errors and allowed successful connections from mail clients.