12

I followed these instructions in order to send mail and here's the Postfix log:

Sep 26 00:46:24 tshepang postfix/smtpd[5728]: 8EE2464931: client=localhost[127.0.0.1] Sep 26 00:47:44 tshepang postfix/cleanup[5810]: 8EE2464931: message-id=<20110925224624.8EE2464931@tshepang> Sep 26 00:47:44 tshepang postfix/qmgr[5772]: 8EE2464931: from=<[email protected]>, size=350, nrcpt=1 (queue active) Sep 26 00:48:04 tshepang postfix/smtp[5859]: 8EE2464931: to=<[email protected]>, relay=none, delay=127, delays=107/0.01/20/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again) Sep 26 00:48:39 tshepang postfix/smtpd[5728]: disconnect from localhost[127.0.0.1] 

Also, this may be relevant (from "/etc/postfix/main.cf"):

myhostname = tshepang mydestination = tshepang, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 inet_interfaces = all inet_protocols = all 

I am running this on Debian 6.

10
  • Check your /etc/resolv.conf for invalid/non-responding resolvers. Try to do a host gmail.com; see if you get results. Commented Sep 25, 2011 at 23:46
  • host gmail.com gives gmail.com has address 74.125.233.24 on the line, and then ;; connection timed out; no servers could be reached on the second. But it's strange because I can ping it. Commented Sep 26, 2011 at 0:23
  • 3
    How about host -t mx gmail.com ? You're right, though, this is somewhat odd. Commented Oct 20, 2011 at 13:15
  • 1
    Another thought: can you add your /etc/resolv.conf to the question? Commented Oct 20, 2011 at 13:21
  • 1
    Yeah. Signs point to a dodgy resolv.conf, possibly due to network-manager or resolvconf not quite playing ball. Commented Oct 22, 2011 at 7:32

7 Answers 7

8

I used to have the same problem:

root@medusa:~# postqueue -p -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- 079AC700080B 357 Wed Apr 3 13:47:47 [email protected] (Host or domain name not found. Name service error for name=xxxx.cz type=MX: Host not found, try again) [email protected] 

..

root@medusa:~# host -t MX xxxx.cz xxxx.cz mail is handled by 10 e2sgw01.xxxx.cz. xxxx.cz mail is handled by 10 e2sgw02.xxxx.cz. 

..

root@medusa:~# telnet e2sgw01.xxxx.cz. 25 Trying 217.77.161.168... Connected to e2sgw01.xxxx.cz. Escape character is '^]'. 220 e2sgw01.xxxx.cz ESMTP Postfix 

The problem was in /var/spool/postfix/etc/resolv.conf file (the chrooted one). Have a look at it.

1
3

Try to disable the chroot property so that its not changerooted the /etc/postfix/master.cf as documented here

# ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - - - - smtpd 

to

# ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - n - - smtpd 
1
2

I able to resolve it by telling to Postfix to use Google DNS , right after Installing postfix:

echo 'nameserver 8.8.8.8' >> /var/spool/postfix/etc/resolv.conf 
1
  • nameserver in postfix can be multiple, or just singular? Commented Dec 16, 2023 at 22:35
1

It look like you are behind a proxy : gmail.com address is resolved, but the ping command does not succeed. You can try to connect directly gmail's SMTP with :

nc -w 1 gmail.com 25 ; echo $? 

if it echoes "1", you can't connect, probably cause of security filtering.

1

As @Shadur pointed out, this issue could be due to your ISP (or the network where your server is installed). If there is a security restrictions on the SMTP port (port number 25), MX servers cannot by reached via this port.

You could try to use the SMTP over SSL port (ssmtp, port number 465) instead. To do this, edit the /etc/postfix/master.cf file, comment the smtp line and add a ssmtp line instead :

# ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== #smtp inet n - - - - smtpd ssmtp inet n - - - - smtpd 

To check that this post is recognized with this name on your machine, you can do :

$>cat /etc/services | grep smtp smtp 25/tcp mail ssmtp 465/tcp smtps # SMTP over SSL 
1

In my case postfix starts up before the system has finished network initialization. So the /var/spool/postfix/etc/resolv.conf is empty.

When I restart postfix, it is no longer empty.

sudo systemctl restart postfix 

After that the mail queue slowly drains.

-1
mkdir /var/spool/postfix/etc cp /etc/resolv.conf /var/spool/postfix/etc/ 
1
  • Your answer is a bit terse and could be improved by explaining the issue, i.e., the underlying cause of the problem and why your solution correctly would resolve it for the user in the question. Commented May 25, 2023 at 17:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.