Debugging postfix

Wanted to see if you have any suggestions as to how to go about debugging postfix issues. I’m not getting emails sent using the Contact Form 7 plugin, so guessing that I need to see if I’ve got configuration issues or something like that. I found the postfix.org site, but wasn’t sure where to start.

Thanks for your advice!

Hi,
We have article on Postfix debugging.
Link: https://rtcamp.com/tutorials/mail/postfix-debugging/

Thank Guarev,

I followed these instructions on one of my easyengine sites and got everything working. The second one was a disaster, hahaha. I followed some incorrect instructions about editing my hostname file and while I have restored it to the original, I can no longer reboot easyengine and my site is now offline.

When U run ‘ee stack restart’ I get the following error:

Unable to execute service nginx restart, exit status = 1

Hi,
Check the output of nginx -t command.
I think you did some wrong changes in Nginx configuration.

Yup, found the bug, fixed it and successfully rebooted.

But still can’t send mail. Tried the suggested:

echo “Test mail from postfix” | mail -s “Test Postfix” [email protected]

But nothing sends. Have tried various debugging steps and have read and re-read the postfix debugging page several times, but not having any luck. I also tried sending mail via PHP but nothing happens there either.

Really confused as to why this was so easy on linode but is so difficult on digital ocean.

After sending mail what output you got in /var/log/mail.log ?
Can you post that here?

Here’s the last attempt since the file is too long to post:

Aug  6 07:20:40 atomicdesign postfix/pickup[2929]: 078DB120B59: uid=0 from=  
Aug  6 07:20:40 atomicdesign postfix/cleanup[4636]: 078DB120B59: message-id=<20140806112040.078DB120B59@atomicdesign>  
Aug  6 07:20:40 atomicdesign postfix/qmgr[2930]: 078DB120B59: from=, size=357, nrcpt=1 (queue active)  
Aug  6 07:20:40 atomicdesign postfix/smtp[4638]: 078DB120B59: to=, relay=mx2.sub4.homie.mail.dreamhost.com[69.163.253.137]:25, delay=0.44, delays=0.01/0.01/0.31/0.11, dsn=5.5.2, status=bounced (host mx2.sub4.homie.mail.dreamhost.com[69.163.253.137] said: 504 5.5.2 : Sender address rejected: need fully-qualified address (in reply to RCPT TO command))  
Aug  6 07:20:40 atomicdesign postfix/cleanup[4636]: 84093120EED: message-id=<20140806112040.84093120EED@atomicdesign>  
Aug  6 07:20:40 atomicdesign postfix/qmgr[2930]: 84093120EED: from=<>, size=2318, nrcpt=1 (queue active)  
Aug  6 07:20:40 atomicdesign postfix/bounce[4639]: 078DB120B59: sender non-delivery notification: 84093120EED  
Aug  6 07:20:40 atomicdesign postfix/qmgr[2930]: 078DB120B59: removed  
Aug  6 07:20:40 atomicdesign postfix/local[4640]: 84093120EED: to=, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)  
Aug  6 07:20:40 atomicdesign postfix/qmgr[2930]: 84093120EED: removed  

Seeing two issues.

First is the hostname. In digitalocean, my droplet is called ‘atomicdesign’ while the full domain is atomicdesignstudios.com. The hostname file just has the droplet name and when I first started editing that (according to one of the posts I found on rtcamp) that’s when things started failing.

The second is “status=bounced (host mx2.sub4.homie.mail.dreamhost.com” – dreamhost was my old hosting company but the A + MX records are already transferring elsewhere and dreamhost isn’t even listed in my DNS records anymore!

Does this help?

First you need to setup hostname,
You can set that by editing /etc/hostname and /etc/hosts/ file. After that you need to reboot your server.

NAlso, we want output of postconf -n command so that we can see the posfix configuration.

Thank Guarav.

I left hostname file alone (using the same format I found on the linode server since that works there). But I updated the hosts file since those options weren’t set up and then did a reboot. Here’s the postconf output:

alias_database = hash:/etc/aliases  
alias_maps = hash:/etc/aliases  
append_dot_mydomain = no  
biff = no  
config_directory = /etc/postfix  
inet_interfaces = all  
inet_protocols = all  
mailbox_size_limit = 0  
mydestination = atomicdesign, localhost.localdomain, localhost  
myhostname = atomicdesign  
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128  
readme_directory = no  
recipient_delimiter = +  
relayhost =  
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache  
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)  
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination  
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem  
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key  
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache  
smtpd_use_tls = yes  

From previous posts,
You are trying to send to to mails [email protected], which has MX record mx1.sub4.homie.mail.dreamhost.com 69.163.253.136 ,
You can check this info on http://www.intodns.com/2futures.org.

Also for these two records in your /etc/postfix/main.cf file:

  
mydestination = atomicdesign, localhost.localdomain, localhost  
myhostname = atomicdesign  

Replace atomicdesign with your FQDN

and restart postfix.
Hope this will help you.

Hi Guarev,

All of this is new to me, so I’ve been struggling to understand everything. I have changed my hostname to ‘quantum’ and reset the main.cf file to match another installation. So I now have:

mydestination = quantum, localhost.localdomain, localhost
myhostname = quantum

Are you suggesting that I need to change those lines to:

mydestination = quantum.atomicdesignstudios.com, localhost.localdomain, localhost
myhostname = quantum.atomicdesignstudios.com

This was counter-intuitive to me because I thought ‘hostname’ and ‘fqdn’ are two different things… that the FQDN CONTAINS the hostname.

Something else is strange… even though I updated the hostname file with ‘quantum’ the old host name ‘atomicdesign’ is still showing up when I test:

Aug  6 15:10:34 atomicdesign postfix/qmgr[3261]: EE1BB120D84: removed  
Aug  6 15:10:34 atomicdesign postfix/smtp[3394]: 8BDD5120D85: to=, relay=none, delay=0.08, delays=0.01/0/0.07/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=atomicdesign type=AAAA: Host not found)  
Aug  6 15:10:34 atomicdesign postfix/qmgr[3261]: 8BDD5120D85: removed

Have now been able to send mail by command line and PHP but wordpress can’t send (using contact form 7). Tried the check email plugin but that didn’t work.

Is it safe to purge postfix from the server and try re-installing? I’m now concerned that some settings have gotten corrupted along the way and its totally unusable at this point and that I should follow the Digital Ocean tutorials for setting up postfix on their servers since the Easy Engine install didn’t seem to work with them.

Gave up and switched to Mandrill.com and now can send emails via WordPress!

Safe to delete postfix from my servers?

If you are using third party service for Mail, then its safe to remove postfix from server.
To remove postfix you can refer this:

Awesome, thanks Gaurev! Really appreciate your help trying to get me through the process yesterday. :wink:

Hi,
Glad to know your issue is solved.