Quote:
Originally Posted by shawnbishop
Just to update you guys
Thanks for the help, but none of them worked, I also found out that M$ Exchange has the same problem.
Cheers
|
Berhanie presented you with the exact solution to your problem in posts #8 and #11. Let's focus on what he said and how you can implement that solution, and why it will work.
I'll just reiterate what you should do. The following commands set the relevant parameters:
Code:
postconf -e "mydomain = company.com"
postconf -e "mydestination = $myhostname localhost.$mydomain localhost $mydomain"
postconf -e "local_recipient_maps = proxy:unix:passwd.byname $alias_maps hash:/etc/postfix/remote_users"
postconf -e "fallback_transport = smtp:[isp.smtp.server]"
The following commands are to unset parameters that have been suggested in this thread, but that should not be set:
Code:
postconf -e "transport_maps = "
postconf -e "relay_domains = "
NOTE: replace isp.smtp.server above with the hostname of your ISP's SMTP server. I put it in brackets so it will not do a DNS lookup for the domain named smtp.server , and will just deliver it to the named server directly.
This is assuming a few things.
1. That your 10 users (user1-user10) who should be delivered locally are defined as local users in the /etc/passwd file.
2. That the file /etc/postfix/remote_users is a table with users that should be sent to the ISP's server on the left-hand-side (LHS), and an arbitrary value on the right-hand-side (RHS).
For instance:
/etc/postfix/remote_users:
Quote:
user11 x
user12 x
user13 x
|
Notice that the left-hand side only lists the user part, and not the @domain part.
Then hash the file with the following command, to make it usable by postfix:
Code:
postmap /etc/postfix/remote_users
Now that the file is indexed and ready to use, refresh postfix with
Now that we're all setup, here's how a typical SMTP transaction will play out.
1. Incoming SMTP connection is accepted by postfix.
2. mail addressed to user1 - user10 will be accepted by SMTP because the "local_recipient_maps" parameter says that local users are defined in the /etc/passwd file. Mail addressed to user11-user60 will be accepted because the "local_recipient_maps" parameter says that these users are listed in the LHS of the /etc/postfix/remote_users file.
3. SMTP accepts the message, and hands it over to the cleanup server, which removes extra headers, adds missing headers, performs address rewriting per "canonical_maps", "masquerade_domains", etc. Cleanup puts the email into the incoming queue and notifies the queue manager (qmgr).
4. qmgr asks trivial-rewrite to resolve the recipient's address into a delivery agent.
5. Trivial-rewrite will resolve the address to a domain class. In this case the local domain class, since they're addressed to a domain that you have listed in the "mydestination" parameter. If there's no overriding transports listed in "transport_maps" (which there isn't if you executed the commands I listed above), then the delivery agent returned will be "local_transport".
6. qmgr will submit a delivery request to local(8), who will try to deliver the mail to a local user's mailbox.
7. For user1-user10, local(8) will succeed since these users exist on the local system.
8. For user11-user60 local(8) will fail, and notify qmgr of the failure.
9. qmgr will see the "fallback_transport" setting, and submit a delivery request to smtp for delivery to isp.smtp.server.
10. If isp.smtp.server accepts the message, qmgr will remove it from the queue and we're done.
11. If not, it will put the mail into the deferred queue and try again sometime in the future.
I left out a lot of details, but I think you can see how the mail should flow thru Postfix, and how the relevant parameters are used for proper delivery.
Now, be as specific as possible in explaining why this setup doesn't work, and where it fails. Especially by posting the relevant parameters. In fact, if it doens't work, please post the output of the following command so we can see what you're doing wrong:
Code:
postconf mydomain mydestination fallback_transport local_recipient_maps transport_maps local_transport relay_domains
and
Code:
ls -l /etc/postfix/remote_users*