PDA

View Full Version : How to setup SMTP server that has high sucessfull delivery rate?



Fli
05-20-2016, 01:10 PM
How to have mail server that sends e-mail via SMTP with high successfull delivery rate?

Mail server: software that send/receive e-mail or a computer that will be used to send/receive e-mail
Nameservers: ns1.yourdomain.tld, ns2.yourdomain.tld
Hostname: yourservername.yourdomainname.yourtld

1. Pick right mail server (most used is probably: Exim, Postfix, Sendmail) comparison:
http://shearer.org/MTA_Comparison#Quick_Answer
https://en.wikipedia.org/wiki/Comparison_of_mail_servers
Exim include both SPF and DKIM by default so its recommended.

2. Get a dedicated IP (not shared) assigned to the server on which mail server will be running.

3. Get a domain that has nameservers which pointing to the IP of your server/mail server). Nameservers can be registered for free by domain registar.

4. Mail server need to have hostname (servername.yourdomain.tld) set (in the server control panel) and nix command: hostname servername.yourdomain.tld

4.5. Install mail server picked in step 1

5. Create new PTR record (mail.yourdomain.tld or smtp.yourdomain.tld), it might be configured a) on your server control panel and b) on billing panel of your IP provider or contact them.

6. In control panel of your server create new DNS record which type should be TXT. We call it SPF record and generate its value using some of the online tools, google: spf wizard
In my case it looks like this:
hostname: @
TTL: 86400
IN TX
Target: v=spf1 ip4:MyServIPHere +a +mx ~all

My MX record is:
Hostname: @
TTL 86400
IN MX
Priority 10
Target: mail.MyDomainHere.Mytld

And i also have A records:
Hostname: @
TTL: 3600
IN A
Target: MyServIPHere

Hostname: mail
TTL: 86400
IN A
Target: MyServIPHere

---
On cPanel server, the SPF is in my case:
Domain: MyDomainHere.Mytld.
TTL: 14400
IN TXT
"v=spf1 +a +mx +ip4:MyServIPHere ~all"

7. In control panel of your server create new DNS record which type should be TXT. We call it DKIM record and the value for this record generate using some of the online tools, google: dkim wizard
Example tool: https://www.port25.com/support/domainkeysdkim-wizard/
For example in cPanel my DKIM TXT DNS record looks like:
Domain: default._domainkey
TTL: 14400
IN TXT
"v=DKIM1; k=rsa; p=LongStringHere" LongStringHere\;

Then set your mailserver to work with the DKIM, example google: exim DKIM how to OR postfix DKIM how to

8. Create e-mail accounts or aliases: [email protected] and [email protected] and create [email protected] (in case the reply address of your emails will be no-reply@)

9. Make sure mail server is not acting like open proxy or open relay. Google: check open relay
I used mxtoolbox.com/diagnostic.aspx and added my server hostname (servername.yourdomain.tld)

10. Veriffy SPF and DKIM configuration by an online tool found in Google: dkim spf check
Also send test email to email address check-auth aaa verifier.port25 dott com and it should return details on how your mail server sent the mail.

11. Send a test e-mail to your Gmail, Hotmail mailboxes and check incoming e-mail headers/source code if everything seems right, google possible errors.

12. Schedule monitoring Your mail server IP address if not on the blacklists:
http://www.senderbase.org/lookup/
http://www.blacklistalert.org/
https://mxtoolbox.com/blacklists.aspx
http://mail-blacklist-monitor.online-domain-tools.com/

gexacor
07-10-2016, 09:27 AM
Really great how-to, thank you

One thing I notice that you didn't show how to install and configure postfix & dovecot exactly step by step
It can be hard for any novice, I can remember it myself

I'd wrote the article about installing and configuring mailserver (https://serversuit.com/community/technical-tips/view/easy-method-to-set-up-a-personal-mailbox.html), maybe it will be helpful. It will add more specific details to your how-to here actually.
I hope that will help someone.