Provider for outgoing mail from own Postfix server

svoop asked:

I’ve been running Postfix on my own dedicated server (hosted by Hetzner) for years, however, it’s getting increasingly difficult get outgoing mail to Outlook/Hotmail and sometimes Google delivered. Outlook/Hotmail is almost always considering my mails as SPAM (unless when present on the address book).

The fix IP my box is running on has no issues, it’s not on any abuse lists. And I try to do what I can to prove trustworthiness (Reverse DNS, SPF, DKIM).

It appears as if the entire IP range of dedicated servers hosted by Hetzner is on a "fishy list" from which an individual IP cannot escape. However, that’s just a feeling, I don’t see how I could find out why exactly Hotmail/Outlook classifying the way it does.

Is there a way to send outgoing mail by use of a provider who can guarantee better deliverability?

(I’m using Mailgun for transactional mails, basically, I’m looking for a way to configure Postfix to use such a service or SMTP.)

Thanks or your hints!

My answer:


I have quite a number of hosts where the local Postfix is configured to relay all mail through Sendgrid. (All of the mail is just the system-generated stuff, such as cron job outputs.) This is very easy in Postfix.

In the main.cf you will set relayhost to the mail server that will accept your mail and provide a postfix DB containing the username and password:

relayhost = [smtp.sendgrid.net]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay
smtp_sasl_security_options =

Then create the /etc/postfix/relay file containing the server, then a tab, then the username, then a colon, then the password:

smtp.sendgrid.net        username:password

Make the DB:

# postmap /etc/postfix/relay

Set the permissions:

# chmod 600 /etc/postfix/relay*

Restart Postfix.

# systemctl restart postfix

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.