If you run a Godaddy VPS server or a Godaddy Dedicated server and the Postfix mail server isn’t sending email to email addresses outside the server (won’t send email to Gmail, Hotmail etc…) check the Postfix ‘/etc/postfix/main.cf‘ file includes this line ‘relayhost = [dedrelay.secureserver.net]‘.
To send external email through a Godaddy server you have to use the above relayhost setting (relay mail server setting), otherwise your emails to Gmail etc… will get ‘stuck’ in the Postfix mail queue with a connection timed out error message!
You’ll see similar errors with other mail servers, it’s not a Postfix only issue. I’d assume other mail servers like Qmail and Sendmail have similar Relayhost settings where you would set ‘dedrelay.secureserver.net‘ as the relay host.
Postfix Mail Servers are Confusing, so many Options!
My sites run on a Godaddy VPS Server running Centos 6.9 with the Virtualmin control panel which by default uses Postfix and Dovecot for sending/receiving email. Despite owning over 100 domains I don’t use them for sending emails per se, I have a few email addresses I use for receiving email, but rarely send email out via them (I use my Gmail accounts for sending email).
I setup the VPS server in January 2017 and it’s October 2017 as I write this article, so it’s taken 10 months to realise I had a Postfix issue with sending email outside the domains on the server! The issue was I could receive email from everywhere and send email to myself (any domain on the server), but couldn’t send emails to other mail servers like Gmail, Hotmail any other domain.
My Godaddy VPS Server Could…
- Receive email from everywhere.
- Send email via seo-gold.com email addresses to other seo-gold.com email addresses (internal email works).
- Send email via stallion-theme.co.uk (another domain on this server) email addresses to seo-gold.com email addresses (internal email works).
- Send email via seo-gold.com email addresses to stallion-theme.co.uk email addresses (internal email works).
- NOT send email via seo-gold.com email addresses to Gmail, Hotmail or other email addresses (external email fails).
I noticed the problem a couple of weeks ago when I modified the Virtualmin/Webmin service monitoring email address.
The monitoring service sends out emails when any of the important services (Apache, MySQL etc…) goes down, the monitor ‘broke’ when I changed the email address from the default email (a mail server on the same server) to a Gmail account (a mail server NOT on the server). MySQL crashed, my sites were down, but I wasn’t notified, the monitoring emails were ‘stuck’ in the Postfix Mail Queue with a connection timed out error message and corresponding messages in the maillog.
Oct 14 06:31:32 s166-62-84-189 postfix/smtp: connect to alt1.gmail-smtp-in.l.google.com[22.214.171.124]:25: Connection timed out
Oct 14 06:31:32 s166-62-84-189 postfix/smtp: connect to mta5.am0.yahoodns.net[126.96.36.199]:25: Connection timed out
Oct 14 06:31:33 s166-62-84-189 postfix/smtp: connect to mx1.spamfiltering.com[188.8.131.52]:25: Connection timed out
Oct 14 06:32:02 s166-62-84-189 postfix/smtp: connect to alt2.gmail-smtp-in.l.google.com[184.108.40.206]:25: Connection timed out
Oct 14 06:32:02 s166-62-84-189 postfix/smtp: connect to mta7.am0.yahoodns.net[220.127.116.11]:25: Connection timed out
Oct 14 06:32:32 s166-62-84-189 postfix/smtp: connect to alt3.gmail-smtp-in.l.google.com[18.104.22.168]:25: Connection timed out
Not particularly helpful error message, “Connection timed out” doesn’t exactly point you in a useful direction.
At first I thought it was just a Gmail issue, though had I looked closer at my logs I’d have realised it wasn’t only Gmail. Spent hours researching issues with Gmail: research indicated Gmail requires a secure connection, so wasted hours modifying various Postfix options (complete waste of time).
Eventually stumbled upon a Godaddy webpage with the title “Find your email relay server | VPS & Dedicated Servers (Hosting Control Center) – GoDaddy Help GB” which had a link to a page with title “Configuring the SMTP Relay Server on Your Linux Server Using Simple Control Panel | VPS & Dedicated Servers (Hosting Control Center) – GoDaddy Help GB” which included the advice:
Enter the following line into /etc/postfix/main.cf using a text editor of your choice:
relayhost = [dedrelay.secureserver.net]
Added the above to my main.cf file, restarted Postfix and the Postfix mail queue emptied soon after (email was sent).
David Law : Freelance SEO Consultant