====== Mail Server ====== One day, I'll be able to write this up for DigitalOcean, and get some credit for my account: [[https://www.digitalocean.com/community/write-for-digitalocean|Write For DigitalOcean Share Your Technical Expertise!]]. But that's gong to take too long! [[https://www.digitalocean.com/community/tutorials/why-you-may-not-want-to-run-your-own-mail-server|Why You May Not Want To Run Your Own Mail Server]] All I want (right now) is to be able to send emails (from applications), and to send/receive on my own address using ''mutt''. Nothing that clever, postfix should be sufficient! ===== Prerequisite(s) ===== ==== DNS ==== Having already configured an email server previously (see some extra notes below), I'd already setup DNS records, similar to in this guide: * See sections "Setting up DNS" & "Verify DNS": [[https://www.digitalocean.com/community/tutorials/how-to-set-up-a-postfix-e-mail-server-with-dovecot|How To Set Up a Postfix E-Mail Server with Dovecot]] * Note for TXT records: * TXT records are a type of Domain Name System (DNS) record that contains text information for sources outside of your domain. You add these records to your domain settings. You can use TXT records for various purposes. Google uses them to verify domain ownership and to ensure email security. * [[https://www.digitalocean.com/community/tutorials/how-to-create-a-spf-record-for-your-domain-with-google-apps|How To Create a SPF Record For Your Domain with Google Apps]] ===== Installation ===== Start off following instructions from the DigitalOcean Community Documentation [[https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-20-04|How To Install and Configure Postfix on Ubuntu 20.04]]. Note, postfix was already installed, so I needed to run: sudo dpkg-reconfigure postfix I followed the instructions up to the point of installing ''s-nail'', I prefer ''mutt''. sudo apt-get install mutt ''mutt'' worked right away, sending an email to my personal email account, and receiving a reply from it. ===== Testing & Checking ===== Sent a test email to: [[http://www.checktls.com/perl/TestSender.pl|Test sender TLS]]. SUCCESSFUL

SUCCESSFUL //email/test From:

Your email was sent securely using TLS.

====== Useful Tricks ====== ===== Migrate Mailbox ===== # Change to home directory cd ~ # Copy mailbox data from backup sudo cp -r /mnt/volume_lon1_01/disk_backup/home/david/Maildir . # Fix file and directory ownership sudo chown -R david:david Maildir ===== bounce (forward) email ===== In ''mutt'' to bounce (forward) an email to another address (say a HTML email forward to a regular mailbox), press ''b'' when the email is selected and then put the address into the application and hit enter. ===== Requirements for Gmail to receive emails ===== ==== MX Records ==== ==== Google Domain TXT record ==== * https://support.google.com/a/answer/183895?hl=en ==== PTR Records ==== > Mail servers must meet a number of requirements to prevent their messages from being blocked, e.g. have a PTR record. The use of authentication methods such as SPF, DKIM or DMARC minimize the chance that messages are marked as spam. * https://stackoverflow.com/questions/15771932/the-ip-youre-using-to-send-mail-is-not-authorized-to-send-email-directly-to-our * https://support.google.com/mail/answer/81126 * Digital Ocean: https://docs.digitalocean.com/products/networking/dns/how-to/manage-records/#ptr-rdns-records ====== Mixed Links ====== Documentation * DigitalOcean Community Documentation (e-mail) 20.04: * [[https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-20-04|How To Install and Configure Postfix on Ubuntu 20.04]] * DigitalOcean Community Documentation (e-mail) Original: * [[https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-16-04|How To Install and Configure Postfix on Ubuntu 16.04]] * Part 1: [[https://www.digitalocean.com/community/tutorials/how-to-set-up-a-postfix-e-mail-server-with-dovecot|How To Set Up a Postfix E-Mail Server with Dovecot]] * Part 2: [[https://www.digitalocean.com/community/tutorials/how-to-set-up-a-postfix-email-server-with-dovecot-dynamic-maildirs-and-lmtp|How To Set Up a Postfix Email Server with Dovecot: Dynamic Maildirs and LMTP]] Various links used in debugging under older installation * [[https://unix.stackexchange.com/questions/108097/suppresss-mail-does-not-exist-in-mutt|Suppresss “~/Mail does not exist” in mutt]]. Just create the dir and have done with it. * [[https://serverfault.com/questions/579138/is-it-ok-to-use-self-signed-certificates-for-smtp-transport|Is it ok to use self-signed certificates for smtp transport?]] * [[http://www.checktls.com/perl/TestSender.pl|Test sender TLS]] * [[https://www.linuxquestions.org/questions/ubuntu-63/postfix-emails-send-outgoing-mail-with-wrong-domain-name-785746/|Postfix emails send outgoing mail with wrong domain name]] * [[https://askubuntu.com/questions/87665/how-do-i-change-the-hostname-without-a-restart|How do I change the hostname without a restart?]] - ''sudo hostname roman-halliday.com'' * [[https://www.digitalocean.com/community/tutorials/how-to-create-a-spf-record-for-your-domain-with-google-apps|How To Create a SPF Record For Your Domain with Google Apps]] Email server testing site: * [[https://mxtoolbox.com/domain/roman-halliday.com/]]