Tag Archive: postfix sendmail centos

PostFix Local Loop in PLESK

April 12, 2012


The problem

A while back, I was having an issue with my mail not being delivered. I would write a function using

and it would successfully send an email to every address EXCEPT one particular address. I couldn’t tell why. This is something that occurs on Parellels’ PLESK server administration software.

The solution

I’ll get to it awfully quick, then I’ll tell you how I figured it out.

First, you need to ask yourself, is this email address the same domain being hosted on PLESK? Bingo. The problem was that when PostFix (the SMTP sendmail uses by default in most cases) determined the address to be the same as the domain it was hosting, it did a local search to find that address rather than just sending the email.

Naturally, if you didn’t have that particular email address set up, or any email with that extension set up on the server, it found nothing, and wouldn’t send the email. There is a very easy fix to this issue by commenting out 3 lines in your Postfix ‘main.cf’ configuration file. This was originally documented by Luke Tarplin, and I can’t explain how helpful it was.

Find your ‘main.cf’ configuration file for PostFix, which for CentOS 6, is located at

If you can’t find it, do a

SSH command to at least see where Postfix is on your server.

Then, open the file up through a text editor, or in the Linux shell, and make these lines (should be at the end of the file, around line 677) :

commented out like this :

Then, restart the Postfix service, and Apache while your at it (can’t hurt), and voila! Your email address should be receiving those emails now. This also doesn’t affect any of your regular emails or anything else, either.

Now, I figured out how to look for this by checking over my mail logs. Any time you have an error with sending an email, check your mail logs. For CentOS, they are located:

although for most Linux OS, they are located

On mine, I noticed that the output for that particular email kept saying

On line 2, you can see that Postfix begins a

search. That was a dead giveaway that for some reason PostFix was reverting to a local search. I put 2 and 2 together and starting searching for the appropriate solution.

If, for some reason, you happen to have similar circumstances but this isn’t the right solution, just remember : Always check your mail logs. It has everything you could ever need to know in fixing a problem. Good luck and happy coding!