10 Replies Latest reply: Mar 1, 2013 1:36 AM by pepmachine
pepmachine Level 1 Level 1 (5 points)

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.

  • 1. Re: Postfix: mail loops back to myself
    Linc Davis Level 10 Level 10 (117,895 points)

    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

  • 2. Re: Postfix: mail loops back to myself
    pepmachine Level 1 Level 1 (5 points)

    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!

  • 3. Re: Postfix: mail loops back to myself
    Linc Davis Level 10 Level 10 (117,895 points)

    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.

  • 4. Re: Postfix: mail loops back to myself
    pepmachine Level 1 Level 1 (5 points)

    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.

  • 5. Re: Postfix: mail loops back to myself
    UptimeJeff Level 4 Level 4 (3,390 points)

    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.

  • 6. Re: Postfix: mail loops back to myself
    pepmachine Level 1 Level 1 (5 points)

    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:

  • 7. Re: Postfix: mail loops back to myself
    pepmachine Level 1 Level 1 (5 points)

    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!

  • 8. Re: Postfix: mail loops back to myself
    pepmachine Level 1 Level 1 (5 points)

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

     

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

  • 9. Re: Postfix: mail loops back to myself
    UptimeJeff Level 4 Level 4 (3,390 points)

    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.

  • 10. Re: Postfix: mail loops back to myself
    pepmachine Level 1 Level 1 (5 points)

    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!