First of all, I want to start out by saying that I followed a very good write up (links below this paragraph) from DigitalOcean to accomplish this exact task. I’m simply putting the key commands here for a quick reference for myself. None of this I take credit for, and that goes to DigitalOcean for the phenomenal write up, so thank you to the folks over there!
Let’s get started. To get this installed, I’m using nano editor as I’m a Linux noob and I like nano. You’ll need a sudo level account, well it will make this a lot easier anyways. This should also require a basic knowledge of the Ubuntu system and the nano editor. As well as any basic mail protocols and DNS would help as well.
Step 1 – Configuring Postfix for SMTP on the localhost interface only
Select Internet Site
For “mail name”, place your domain or subdomain you would like mail to be delivered as. Example, mrtwade.com or mail.mrtwade.com.
Only accept SMTP requests from the local interface:
Test the mail server. In the [email protected], place your email instead. This will likely end up in your spam folder so be sure to check there:
Step 2 – Configure DKIM
Add this block of code to the end of the file:
Add this line to that file:
Make sure that these two lines are in the file and not commented out:
In that same file, if these are not present (or if they are), modify / add the following lines to the end of the file:
Create a directory structure that will hold the trusted hosts, key tables, signing tables and crypto keys:
Goes without saying, change example.com with your domain:
Create a key table (again, change example.com to your domain):
Create a signing table (do I really need to say it again?):
Generate the public and private keys
Add the public key to the domain’s DNS records. I found it easier to use FileZilla to copy the mail.txt contents, but do what you wish here. You don’t want to add the entire contents to DNS, just the following line (yours will be different, so copy that one, not the one below):
In you DNS provider, create a new TXT record:
Add SPF records to your DNS
Adding a valid SPF record can also help avoid Spam filters. This varies on your provider but typically doing something like this will help. Granted, if your DNS for this server has A records for the IP in which the domain your are editing…