Postfix Mail Forwarding: Socket Error ..How to fix MX records?

April 26, 2015 10.9k views
Email Miscellaneous

Hello --

I sent test messages from my personal gmail account to test if the mail forwarding is working ( which should work as all the configurations are in place, now), none of the test messages are delivered and this is what I see in the "mail delivery subsystem message"

"The recipient server did not accept our requests to connect. Learn more at http://support.google.com/mail/bin/answer.py?answer=7720
[(5) mail.yenidensen.com. [178.62.224.65]:25: socket error]"

And when I click on the support.google, I see below. Clearly, there is aproblem with the MX records, how do I get this issue solved, any ideas?

DO's Support team cant help here.

'The recipient server did not accept our requests...'

This error message means that we tried to reach the server of the person you’re sending an email to, but didn’t get a reply, so we couldn’t send your email. This could be a temporary problem, and we suggest you try again later.

You could also contact the customer service department of the other domain (the one you’re sending to). The problem might be because:

The other domain doesn't have up-to-date MX records or is otherwise misconfigured.
The other domain is blacklisting or graylisting messages from Gmail.
The other domain has temporary networking problems.

10 Answers

Problem solved!! Changed inet_interfaces = all.

Thanks to Parminder Singh from the support team.

Happy Sunday! :)

  • Thank you very much. Searched the web for hours

    sudo vim /etc/postfix/main.cf
    -- press i
    -- go to inetinterfaces
    -- set inet
    interfaces to all
    sudo service postfix restart

  • After sudo vim /etc/postfix/main.cf
    I get no option with (i) but Open read only, Edit, Delete.

    When opening the file it shows:

    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname
    
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    
    readme_directory = no
    
    # TLS parameters
    smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_use_tls=yes
    "/etc/postfix/main.cf" [readonly] 42L, 1378C                  1,1           Top
    

    So no inet_interfaces = all.

What makes you think it's "clearly a problem with the MX records"?

Wouters-MBP:~ Woet$ dig +short MX yenidensen.com
5 mail.yenidensen.com.
Wouters-MBP:~ Woet$ dig +short A mail.yenidensen.com
178.62.224.65
Wouters-MBP:~ Woet$ telnet 178.62.224.65 25
Trying 178.62.224.65...
telnet: connect to address 178.62.224.65: Connection refused
telnet: Unable to connect to remote host
Wouters-MBP:~ Woet$

Hi! The MX records appear to be properly configured, however, I'm not able to access port 25 (SMTP) on 178.62.224.65.

Do you have a firewall running? Please post the output of the following command:

sudo ufw status

If you are not using UFW or if it outputs an error, try the following command instead:

sudo iptables -L -n -v
  • We haven't setup any firewalls when creating the droplet as far as I recall.

    root@yenidensen:~# sudo ufw status
    Status: inactive

    root@yenidensen:~# sudo iptables -L -n -v
    Chain INPUT (policy ACCEPT 10726 packets, 1850K bytes)
    pkts bytes target prot opt in out source destination

    Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts bytes target prot opt in out source destination

    Chain OUTPUT (policy ACCEPT 12120 packets, 2953K bytes)
    pkts bytes target prot opt in out source destination

    root@yenidensen:~#

  • Okay, the firewall settings are not blocking any connections so the issue must be something else. Is postfix running? Run this command to check if it is and see what IP address it is listening on:

    sudo netstat -plutn | grep 25
    
    • I am having same problem but so far none of this has worked for me.

      sudo netstat -plutn | grep 25
      tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 5300/master
      tcp6 0 0 :::25 :::* LISTEN 5300/master
      help please!!!!!

Per gmail mail not delivered message suggest so. Kindly note that I am not a developer so I may be missing a point to two.

So what do you think is the problem?
Droplet is up and running. I don't understand why you cannot connect to it in the above screen.

Good to isolate one problem! Here is

postfix is running:
root@yenidensen:~# sudo postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 1027

root@yenidensen:~# sudo netstat -plutn | grep 25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1027/master

root@yenidensen:~#

root@yenidensen:~# sudo netstat -plutn | grep 25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1027/master

root@yenidensen:~# sudo postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 1027
root@yenidensen:~#

where is this line to change i am having the same [ip]25 socket error only i can send mails from server not able to receive

inet_interfaces = all. where is this
Thanks In Advance

Not an answer, but a question. I sent an email from my Android phone using a gmail address and got this same message. If I don't fix what caused the "socket error" will the email continue to fail?

This is how I did it (using nano instead of vim):

  1. SSH-Login root
  2. type "sudo nano /etc/postfix/main.cf"
  3. Find line "inet_interfaces = loopback-only" and replace with "inet_interfaces = all"
  4. Save by CTRL+X and hit Y
  5. restart postfix by "sudo /etc/init.d/postfix restart"

I am facing this issue as well, but seems that fail2ban is running. The "iptables -L -n -v" command resulted with:

Chain INPUT (policy ACCEPT 162K packets, 14M bytes)
pkts bytes target prot opt in out source destination
25717 1384K fail2ban-sasl tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 25,465,587,143,220,993,110,995
9563 643K fail2ban-ssh tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 22

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 162K packets, 217M bytes)
pkts bytes target prot opt in out source destination

Chain fail2ban-sasl (1 references)
pkts bytes target prot opt in out source destination
15 624 REJECT all -- * * 117.68.172.107 0.0.0.0/0 reject-with icmp-port-unreachable
16 688 REJECT all -- * * 117.68.173.27 0.0.0.0/0 reject-with icmp-port-unreachable
14 608 REJECT all -- * * 60.168.181.130 0.0.0.0/0 reject-with icmp-port-unreachable
17 728 REJECT all -- * * 36.7.102.186 0.0.0.0/0 reject-with icmp-port-unreachable
3 152 REJECT all -- * * 49.88.197.88 0.0.0.0/0 reject-with icmp-port-unreachable
6 300 REJECT all -- * * 49.88.197.183 0.0.0.0/0 reject-with icmp-port-unreachable
11 488 REJECT all -- * * 60.168.183.211 0.0.0.0/0 reject-with icmp-port-unreachable
11 480 REJECT all -- * * 117.68.174.95 0.0.0.0/0 reject-with icmp-port-unreachable
15 648 REJECT all -- * * 36.7.103.48 0.0.0.0/0 reject-with icmp-port-unreachable
11 488 REJECT all -- * * 36.7.102.4 0.0.0.0/0 reject-with icmp-port-unreachable
22 920 REJECT all -- * * 117.68.174.139 0.0.0.0/0 reject-with icmp-port-unreachable
9 384 REJECT all -- * * 60.168.178.104 0.0.0.0/0 reject-with icmp-port-unreachable
14 584 REJECT all -- * * 117.68.172.19 0.0.0.0/0 reject-with icmp-port-unreachable
14 576 REJECT all -- * * 60.168.183.202 0.0.0.0/0 reject-with icmp-port-unreachable
28 1396 REJECT all -- * * 59.126.5.205 0.0.0.0/0 reject-with icmp-port-unreachable
22 1048 REJECT all -- * * 41.86.98.36 0.0.0.0/0 reject-with icmp-port-unreachable
6 288 REJECT all -- * * 117.68.174.163 0.0.0.0/0 reject-with icmp-port-unreachable
13 552 REJECT all -- * * 117.68.174.11 0.0.0.0/0 reject-with icmp-port-unreachable
19 880 REJECT all -- * * 117.68.173.42 0.0.0.0/0 reject-with icmp-port-unreachable
13 544 REJECT all -- * * 60.168.181.49 0.0.0.0/0 reject-with icmp-port-unreachable
10 424 REJECT all -- * * 117.68.173.65 0.0.0.0/0 reject-with icmp-port-unreachable
30 1532 REJECT all -- * * 37.49.225.88 0.0.0.0/0 reject-with icmp-port-unreachable
41 2012 REJECT all -- * * 181.49.39.70 0.0.0.0/0 reject-with icmp-port-unreachable
18 852 REJECT all -- * * 198.53.60.171 0.0.0.0/0 reject-with icmp-port-unreachable
26 1316 REJECT all -- * * 181.60.254.53 0.0.0.0/0 reject-with icmp-port-unreachable
3 134 REJECT all -- * * 117.68.173.13 0.0.0.0/0 reject-with icmp-port-unreachable
10 424 REJECT all -- * * 60.168.183.15 0.0.0.0/0 reject-with icmp-port-unreachable
15 648 REJECT all -- * * 60.168.179.91 0.0.0.0/0 reject-with icmp-port-unreachable
932 47532 REJECT all -- * * 185.234.216.195 0.0.0.0/0 reject-with icmp-port-unreachable
1140 58140 REJECT all -- * * 185.234.216.225 0.0.0.0/0 reject-with icmp-port-unreachable
716 36528 REJECT all -- * * 185.234.218.157 0.0.0.0/0 reject-with icmp-port-unreachable
4139 211K REJECT all -- * * 185.234.216.121 0.0.0.0/0 reject-with icmp-port-unreachable
4774 243K REJECT all -- * * 185.234.216.114 0.0.0.0/0 reject-with icmp-port-unreachable
3653 186K REJECT all -- * * 212.34.242.82 0.0.0.0/0 reject-with icmp-port-unreachable
6821 332K REJECT all -- * * 164.39.218.210 0.0.0.0/0 reject-with icmp-port-unreachable
3110 249K RETURN all -- * * 0.0.0.0/0 0.0.0.0/0

Chain fail2ban-ssh (1 references)
pkts bytes target prot opt in out source destination
19 1096 REJECT all -- * * 41.47.57.126 0.0.0.0/0 reject-with icmp-port-unreachable
21 948 REJECT all -- * * 186.47.168.100 0.0.0.0/0 reject-with icmp-port-unreachable
18 816 REJECT all -- * * 171.228.178.80 0.0.0.0/0 reject-with icmp-port-unreachable
21 1208 REJECT all -- * * 54.37.65.142 0.0.0.0/0 reject-with icmp-port-unreachable
1 60 REJECT all -- * * 148.229.1.28 0.0.0.0/0 reject-with icmp-port-unreachable
18 816 REJECT all -- * * 14.177.24.232 0.0.0.0/0 reject-with icmp-port-unreachable
18 816 REJECT all -- * * 188.135.38.22 0.0.0.0/0 reject-with icmp-port-unreachable
20 1148 REJECT all -- * * 31.207.47.5 0.0.0.0/0 reject-with icmp-port-unreachable
18 1668 REJECT all -- * * 58.42.228.170 0.0.0.0/0 reject-with icmp-port-unreachable
36 2064 REJECT all -- * * 59.30.101.105 0.0.0.0/0 reject-with icmp-port-unreachable
23 1336 REJECT all -- * * 109.68.126.139 0.0.0.0/0 reject-with icmp-port-unreachable
26 1500 REJECT all -- * * 45.55.235.208 0.0.0.0/0 reject-with icmp-port-unreachable
150 9000 REJECT all -- * * 23.23.191.131 0.0.0.0/0 reject-with icmp-port-unreachable
22 1260 REJECT all -- * * 5.101.40.81 0.0.0.0/0 reject-with icmp-port-unreachable
20 1148 REJECT all -- * * 191.209.224.246 0.0.0.0/0 reject-with icmp-port-unreachable
18 816 REJECT all -- * * 14.161.20.194 0.0.0.0/0 reject-with icmp-port-unreachable
18 816 REJECT all -- * * 14.232.150.24 0.0.0.0/0 reject-with icmp-port-unreachable
19 1600 REJECT all -- * * 37.193.120.203 0.0.0.0/0 reject-with icmp-port-unreachable
119 7092 REJECT all -- * * 108.24.130.124 0.0.0.0/0 reject-with icmp-port-unreachable
23 1336 REJECT all -- * * 181.176.181.150 0.0.0.0/0 reject-with icmp-port-unreachable
19 1116 REJECT all -- * * 196.21.57.1 0.0.0.0/0 reject-with icmp-port-unreachable
26 1500 REJECT all -- * * 54.36.98.89 0.0.0.0/0 reject-with icmp-port-unreachable
18 1704 REJECT all -- * * 101.109.98.28 0.0.0.0/0 reject-with icmp-port-unreachable
17 980 REJECT all -- * * 117.121.102.231 0.0.0.0/0 reject-with icmp-port-unreachable
17 980 REJECT all -- * * 103.50.255.6 0.0.0.0/0 reject-with icmp-port-unreachable
18 1704 REJECT all -- * * 210.13.64.18 0.0.0.0/0 reject-with icmp-port-unreachable
24 1400 REJECT all -- * * 14.142.40.59 0.0.0.0/0 reject-with icmp-port-unreachable
14 776 REJECT all -- * * 124.128.89.187 0.0.0.0/0 reject-with icmp-port-unreachable
15 852 REJECT all -- * * 120.92.142.101 0.0.0.0/0 reject-with icmp-port-unreachable
10 900 REJECT all -- * * 42.7.26.16 0.0.0.0/0 reject-with icmp-port-unreachable
27 1360 REJECT all -- * * 91.236.178.157 0.0.0.0/0 reject-with icmp-port-unreachable
22 1268 REJECT all -- * * 169.60.177.38 0.0.0.0/0 reject-with icmp-port-unreachable
6918 416K REJECT all -- * * 58.218.198.168 0.0.0.0/0 reject-with icmp-port-unreachable
2 120 REJECT all -- * * 194.182.68.218 0.0.0.0/0 reject-with icmp-port-unreachable
2 120 REJECT all -- * * 176.31.162.173 0.0.0.0/0 reject-with icmp-port-unreachable
1786 176K RETURN all -- * * 0.0.0.0/0 0.0.0.0/0

And port 25 is open, as "netstat -plutn | grep 25" yields:

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 3542/master
tcp6 0 0 :::25 :::* LISTEN 3542/master

inet_interfaces is already set to all. Any ideas what to do?

Have another answer? Share your knowledge.