pepmachine

Q: Postfix: mail loops back to myself

I have the feeling that my issue is not very complicated (if you know Postfix that is) or maybe my reasoning is wrong but I can’t seem to make it work. I hope somebody can point me in the right direction!

 

I am trying to set up a local mailserver on my macmini loaded with OS X Server (all latest versions) The sole purpose would be sending calendar invitations via the local email server.

 

I am using the same domain name.

 

My (hosted) email address looks like this: name@domain.com and runs on the host server.

My local server address is: server.domain.com.

I created an extra A record for mail: mail.domain.com.

My server has a machine record for mail.domain.com and a mail exchanger (MX) record also for mail.domain.com.

My local server Mail setting is: Provide mail for: domain.com (not mail.domain.com). I am not sure if this is correct, both ways allow mail to be send, both ways result in the loop error.

 

My issue: from my OSX Server account (name@mail.domain.com) I can send email to any address except to name@domain.com. Whatever I do (tried several suggestions altering the main.cf file) it keeps returning my email with the ‘mail for domain.com loops back to myself’ error.

Sending an email from my name@domain.com account to name@mail.domain.com works fine. Sending a mail from name@mail.domain.com to name@mail.domain.com (to the same address) also works fine.

I experimented with these lines in main.cf:

mydestination = $myhostname, localhost.$mydomain, localhost

mydomain = domain.com

myhostname = mail.domain.com

I tried many variables but the loop error doesn’t go away…

 

I hope somebody knows how to configure the main.cf file to fix this looping error!

Many thanks in advance.

Pepijn.

Posted on Feb 25, 2013 4:41 AM

Close

Q: Postfix: mail loops back to myself

  • All replies
  • Helpful answers

  • by Linc Davis,

    Linc Davis Linc Davis Feb 25, 2013 7:45 AM in response to pepmachine
    Level 10 (208,000 points)
    Applications
    Feb 25, 2013 7:45 AM in response to pepmachine

    best_mx_transport (default: empty)
      

    Where the Postfix SMTP client should deliver mail when it detects a "mail loops back to myself" error condition. This happens when the local MTA is the best SMTP mail exchanger for a destination not listed in $mydestination, $inet_interfaces, $proxy_interfaces, $virtual_alias_domains, or $virtual_mailbox_domains. By default, the Postfix SMTP client returns such mail as undeliverable.

       

    Specify, for example, "best_mx_transport = local" to pass the mail from the Postfix SMTP client to the local(8) delivery agent. You can specify any message delivery "transport" or "transport:nexthop" that is defined in the master.cf file. See the transport(5) manual page for the syntax and meaning of "transport" or "transport:nexthop".

      

    However, this feature is expensive because it ties up a Postfix SMTP client process while the local(8) delivery agent is doing its work. It is more efficient (for Postfix) to list all hosted domains in a table or database.

     

    Postfix Configuration Parameters

     

    See also:

     

    smtp - mail loops back to myself | postfix - Server Fault

  • by pepmachine,

    pepmachine pepmachine Feb 25, 2013 8:26 AM in response to Linc Davis
    Level 1 (5 points)
    Feb 25, 2013 8:26 AM in response to Linc Davis

    Thanks for the quick reply!

     

    Although I understand what I am looking at I really don't understand how it works. I am an experienced Mac user but this stuff is pretty new for me.

     

    Here are some (hope not to stupid) questions.

     

    What does local MTA mean?

    Where do find best_mx_transport for example (in what file)?

    How and where (in what file) do I list all hosted domains in a table or database?

     

    Can I show you the content of certain files so you can tell me what to change?

    Would be much appreciated!

  • by Linc Davis,

    Linc Davis Linc Davis Feb 25, 2013 9:36 AM in response to pepmachine
    Level 10 (208,000 points)
    Applications
    Feb 25, 2013 9:36 AM in response to pepmachine

    What does local MTA mean?

     

    Mail Transfer Agent. The SMTP server.

     

    Where do find best_mx_transport for example (in what file)?

     

    It's not in any file by default. You would add it to the main.cf file, which on OS X Server is

     

    /Library/Server/Mail/Config/postfix/main.cf

     

    How and where (in what file) do I list all hosted domains in a table or database?

     

    In the virtual_alias_domains parameter in main.cf.

     

    Can I show you the content of certain files so you can tell me what to change?

     

    That goes beyond what I have time for. You're trying to do very advanced server configuration. I've given you pointers to the information you need. You can either follow those pointers, or hire a consultant to solve the problem for you. I don't have a specific recommendation.

  • by pepmachine,

    pepmachine pepmachine Feb 25, 2013 1:27 PM in response to Linc Davis
    Level 1 (5 points)
    Feb 25, 2013 1:27 PM in response to Linc Davis

    Thanks for your help and info! It did put me on a new path. I guess I'll have to dig deeper to get it working exactly as I want. I understand I was asking a bit much...

     

    If anybody else has something to add, please do!

    Pepijn.

  • by UptimeJeff,

    UptimeJeff UptimeJeff Feb 26, 2013 1:52 PM in response to pepmachine
    Level 4 (3,477 points)
    Feb 26, 2013 1:52 PM in response to pepmachine

    My guess, mail.domain.com needs an MX of its own which points to mail.domain.com

         mail.domain.com  MX   0   mail.domain.com

     

    Your server should be set to receive mail ONLY for mail.domain.com

     

    Make sure domain.com has the proper MX pointing to your mail host

         domain.com MX   smtp.mailhost.com

     

    if you post your real domain, it would be much easier to tell you what the config should look like.

  • by pepmachine,

    pepmachine pepmachine Feb 27, 2013 12:53 AM in response to UptimeJeff
    Level 1 (5 points)
    Feb 27, 2013 12:53 AM in response to UptimeJeff

    Thanks for your input!

     

    I rather not use my comanyname (the domain) as an example. Trying to keep out of spammers databases.

    Lets call it videomachine, my mail domain looks like : mail.videomachine.com, my server domain looks like server.videomachine.com.

     

    It does sound like a possible solution, just don't know how to execute.

    Here some questions:

    Should I make the MX's at the host or at my local server?

    My host gives me these options:

    First, 'Use One.com mail servers', second, 'Setup different mail servers (advanced).

    When I choose the second option I get the MX configuration field(s). It looks like this:

  • by pepmachine,

    pepmachine pepmachine Feb 27, 2013 1:32 AM in response to pepmachine
    Level 1 (5 points)
    Feb 27, 2013 1:32 AM in response to pepmachine

    continued..

     

     

     

    My server site looks like this (removed the domain name everywehere, in our example this would be videomachine). The send.one.com represents the smtp server from my host. Not sure if it should be here or at my host.

    Screen Shot 2013-02-27 at 10.05.30 AM.jpg

    Hope this makes sense.

    Thanks!

  • by pepmachine,

    pepmachine pepmachine Feb 27, 2013 1:45 AM in response to pepmachine
    Level 1 (5 points)
    Feb 27, 2013 1:45 AM in response to pepmachine

    Having problems adding pictures, this post should come before the previous one.

     

    Screen Shot 2013-02-27 at 9.54.12 AM.jpg

  • by UptimeJeff,Solvedanswer

    UptimeJeff UptimeJeff Feb 27, 2013 10:42 AM in response to pepmachine
    Level 4 (3,477 points)
    Feb 27, 2013 10:42 AM in response to pepmachine

    too short on time to digest this. its much easier to look at your real DNS as it exists.

    if you want to send your real domain, use my contact info is in my profile.

  • by pepmachine,

    pepmachine pepmachine Mar 1, 2013 1:36 AM in response to UptimeJeff
    Level 1 (5 points)
    Mar 1, 2013 1:36 AM in response to UptimeJeff

    My host doesn't allow me to create subdomain MX records. Therefore (at least at this host) I can't run a seperate mail server. If I would move my DNS handling somewhere else this would of course be possible. I created a new calendar email account at my host. Using this for sending invites works fine.

    In time I will probably move my DNS handling. Untill that time I have fully functional calendar services thanks to Jeff.

    Thanks Jeff for your time!

  • by helpdesk_fixeads,

    helpdesk_fixeads helpdesk_fixeads Aug 21, 2015 5:26 AM in response to Linc Davis
    Level 1 (0 points)
    Aug 21, 2015 5:26 AM in response to Linc Davis

    best_mx_transport=local

     

    This really helped to solve my problem.

     

    Postfix was unable to deliver to local mailboxes even if i configured mydestinations with my local domain and hostname.

    Not the messages about "Loops back to myself" have stopped!

     

    Thanks!