PostFix Local Loop in PLESK

April 12, 2012

THIS ARTICLE IS A SOLUTION FOR PLESK 10.4 AND EARLIER.
TO VIEW THE MOST UPDATED ARTICLE, VISIT HERE

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!

12 Comments

  • Schmiddae

    With the newer version (disable emailservice for this domain), the users couldn’t login their email accounts anymore. (Plesk 17.5)
    When I commented out the three lines from above (and restarted postfix+apache), the local delivery was disabled and everything was delivered to the right relayhosts.

    The thing was – you couldn’t recieve emails anymore – I got:
    454 4.7.1 : Relay access denied;
    (tried it with a working domain, no worries ^^)

    This feels to be the right way, but Plesk does not seem to recognize it’s recepience anymore.

    Has there been a workaround lately?

  • Rob Coldwell

    I’ve been struggling with this issue for a while now on our 1&1 Plesk server – thanks so much, this fixed it for me!

  • Tato

    Thanks Thanks Thanks Thanks, That fixed my issue in a vps server

  • Simon

    Dude!! You Rock!!!

  • tetrapac

    Hi Neil!

    Thx Dude for this awsome solution! :) You made my day! :)

    Regards!

    tetrapac

  • Eugen

    Hi,

    I had the same issue, commenting those three lines:

    #virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
    #virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
    #virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox

    …could be a fix for 1and1 webmail use.

    But, if u want to use the roundcube email on 1and1 dedicated server, commenting those lines will broke postfix, the roundcube emails will not work. (you can send but u’ll be not able to recive external emails)
    A quick solution for that could be: /usr/local/psa/bin/mail –off domain.tld (turning off the subscription emails)

  • Serhan

    Thanks a million..! That fixed my issue…

  • Seanie

    had the same problem, it is related to the virtual mappings not re-writing properly.
    Turns out the issue related to the email address in the Main Panel Profile being the same as the contact email on a subscription.

    Click on Profile & Preferences in the Left Column and check the email address in there. Then see if any subscription has the same one. If so, change it.

    You might need to add or modify a subscription then, to get the table re-written properly.

    Hope that sorts it for you. Solved it for me.

  • AceLine

    Hi, I had exactly this problem and your solution worked for me well. But…

    Since I made this changes local mail delivery on other domains does not work anymore!

    Means, e.g. dmail.at is located on this plesk server and is our primary mail domain. On this domain no mails are delivered anymore. It is dead, lets say…

    Do you have any idea how to combine your solution with the old state?

    Thanks in advance!

    AceLine

  • RCNeil

    Haha, no problem. I spent hours pulling my hair out trying to figure out why this was happening. Same thing, PLESK on a 1&1 dedicated server. They don’t really give you much heads up as to what to do when you get it (as it was my first ded. server), but trust me, after 6 months, you’ll be an expert. Glad you could figure it out!

  • Peter Holcomb

    I could hug you. This helped me fix my email issue on my new 1and1 dedicated server. Cheers!

  • eman2112

    thank you!!!

Leave a Reply

Your email address will not be published. Required fields are marked *