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:35 AM

Reply
11 replies

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

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!

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.

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.

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:

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!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Postfix: mail loops back to myself

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.