Unable to forward mail from external account to external account
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Unable to forward mail from external account to external account
Hello guys.
I have a smart host (remote.domainX.pt) connected with a remote mail server (mail.domainY.pt), that uses getmail to receive mail from that mail.domainY.pt, and then reroute it with sendmail to local user accounts in this server. My smart host uses mydomain as domainX.pt, config in postfix. I am able to login clients with this smart host, using domainX.pt. To send mail i am using smtp_sasl_password_maps:
Code:
test<a>domainX.pt test<a>domainX.pt:qwe123
NOTE that i cannot post at sign because i am a newbie here in this forum so i have used <a> instead.
And didnt notice that i was using my <a>remote.domainX.pt local domain instead of the <a>domainX.pt do receive mail at postfix. When i tried to redirect mail (with postfix aliases) from a gmail account through this smart host to another gmail account, postfix didnt send my mails with <a>domainX.pt, it sends as <a>remote.domainX.pt, and as expected i receive a message from my remote server saying:
Code:
Dec 6 14:37:12 remote.domainX.pt postfix/smtp[28504]: 0B8BD259F57: to=<test<a>gmail.com>, orig_to=<test<a>remote.domainX.pt>, relay=mail.domainX.pt[]:25, delay=0.1, delays=0/0.01/0.07/0.02, dsn=5.0.0, status=bounced (host mail.domainX.pt[] said: 550-Verification failed for <Xserver<a>remote.domainX.pt> 550-No Such User Here 550 Sender verify failed (in reply to RCPT TO command))
After some tests at sendmail through getmail, i also notice that i could only use local user account names as destination or use full email name only with <a>remote.domainX.pt and not <a>domainX.pt as i was expecting.
I have also tested with virtual_alias_maps instead of aliases from alias_maps but with that there is no domain associated to my local accounts, it can only be used to local delivery.
Until it starts to redirect mail to test3 and test4 from other domain it sends locally through sendmail from local user test to test<a>remote.domainX.pt:
Code:
Dec 9 11:50:06 remote.domainX.pt postfix/smtp[1734]: C39B729E55F: to=<test<a>remote.domainX.pt>, orig_to=<test>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.5, delays=0.01/0/0/5.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 41CE429E581)
Dec 9 11:50:06 remote.domainX.pt postfix/pipe[99700]: 41CE429E581: to=<test3<a>domainX.pt>, orig_to=<test<a>remote.domainX.pt>, relay=dovecot, delay=0.03, delays=0/0/0/0.03, dsn=2.0.0, status=sent (delivered via dovecot service)
Dec 9 11:50:06 remote.domainX.pt postfix/local[1823]: 41CE429E581: to=<test<a>remote.domainX.pt>, relay=local, delay=0.03, delays=0/0/0/0.03, dsn=2.0.0, status=sent (forwarded as 48E2929E585)
Dec 9 11:50:06 remote.domainX.pt postfix/smtp[1879]: 48E2929E585: to=<test4<a>domainY.pt>, orig_to=<test<a>remote.domainX.pt>, relay=mail.domainX.pt[94.126.172.X]:587, delay=0.09, delays=0/0.01/0.06/0.02, dsn=5.0.0, status=bounced (host mail.domainX.pt[94.126.172.X] said: 550-Verification failed for <Xserver<a>remote.domainX.pt> 550-No Such User Here 550 Sender verify failed (in reply to RCPT TO command))
But when i try to send directly i send as <a>domainX.pt:
Code:
Dec 9 11:53:54 remote.domainX.pt postfix/pickup[99897]: A3CAC29E670: uid=70 from=<test<a>domainX.pt>
Dec 9 11:53:54 remote.domainX.pt postfix/qmgr[97642]: A3CAC29E670: from=<test<a>domainX.pt>, size=510, nrcpt=1 (queue active)
Dec 9 11:53:54 remote.domainX.pt postfix/qmgr[97642]: B0C3E29E677: from=<test<a>domainX.pt>, size=957, nrcpt=1 (queue active)
If i set sendmail to send as test<a>domainX.pt i get this:
Code:
Dec 9 12:13:06 remote.domainX.pt postfix/local[1823]: A508B29EAEA: to=<teste<a>domainX.pt>, relay=local, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail forwarding loop for teste<a>domainX.pt)
Dec 9 12:13:06 remote.domainX.pt postfix/smtp[2561]: 3E66429EAC9: to=<teste<a>domainX.pt>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.4, delays=0/0/0/5.4, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as A508B29EAEA)
After a while i tried to set sendmail arguments to test<a>domainX.pt and then used virtual alias maps instead of alias maps (aka aliases) to be able to set the full email name test<a>domainX.pt, and then i notice that it had fixed part of the problem:
Code:
Dec 9 12:52:06 remote.domainX.pt postfix/smtp[4026]: 9C4B029F3E0: to=<test<a>domainY.pt>, orig_to=<test<a>domainX.pt>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.5, delays=0.02/0/0/5.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 1723529F40A)
But here it was relaying to localhost instead of my remote server. In main.cf i have a relayhost to remote server and i also have sasl_password and dependent_relayhost_maps.
So i am trying to figure out how can i solve this with postfix to be able to forward mail from external domains to external domains but i am not seeing a way to fix/do this.
Those logs are helpful. But you need to post your Postfix config. People here need to know if your mail server is configured to accept for your relayed domains; to see lines that mentions 'virtual_*'; the user mapping (local account to external account). This is most likely declared at 'virtual_alias_maps' or 'virtual_mailbox_maps'.
And for the ultimate information, see the offical Postifx guide.
Those logs are helpful. But you need to post your Postfix config. People here need to know if your mail server is configured to accept for your relayed domains; to see lines that mentions 'virtual_*'; the user mapping (local account to external account). This is most likely declared at 'virtual_alias_maps' or 'virtual_mailbox_maps'.
And for the ultimate information, see the offical Postifx guide.
I have also tried with virtual_alias_maps instead of alias_maps, and i notice that i could send with getmail through sendmail with domainX.pt, with that i could send with the right sender domain, but it sends to localhost:
Code:
Dec 9 12:52:06 remote.domainX.pt postfix/smtp[4026]: 9C4B029F3E0: to=<test@domainY.pt>, orig_to=<test@domainX.pt>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.5, delays=0.02/0/0/5.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 1723529F40A)
Resuming, with alias_maps, i have the right relay but the wrong sender domain (@remote.domainX.pt), with virtual_alias_maps, it uses a wrong relay (localhost) and the right sender (@domainX.pt), as you can see above.
Dec 9 11:50:06 remote.domainX.pt postfix/smtp[1734]: C39B729E55F: to=<test<a>remote.domainX.pt>, orig_to=<test>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.5, delays=0.01/0/0/5.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 41CE429E581)
Dec 9 11:50:06 remote.domainX.pt postfix/pipe[99700]: 41CE429E581: to=<test3<a>domainX.pt>, orig_to=<test<a>remote.domainX.pt>, relay=dovecot, delay=0.03, delays=0/0/0/0.03, dsn=2.0.0, status=sent (delivered via dovecot service)
Dec 9 11:50:06 remote.domainX.pt postfix/local[1823]: 41CE429E581: to=<test<a>remote.domainX.pt>, relay=local, delay=0.03, delays=0/0/0/0.03, dsn=2.0.0, status=sent (forwarded as 48E2929E585)
Dec 9 11:50:06 remote.domainX.pt postfix/smtp[1879]: 48E2929E585: to=<test4<a>domainY.pt>, orig_to=<test<a>remote.domainX.pt>, relay=mail.domainX.pt[94.126.172.X]:587, delay=0.09, delays=0/0.01/0.06/0.02, dsn=5.0.0, status=bounced (host mail.domainX.pt[94.126.172.X] said: 550-Verification failed for <Xserver<a>remote.domainX.pt> 550-No Such User Here 550 Sender verify failed (in reply to RCPT TO command))
So, this is the remote.domainX.pt machine. The account 'test' sent a message to itself as shown by line 1 (test@remote.domainX.pt) and the messages gets feed to amavis at port 10025 for filtering. And then it gets sent to another local account 'test3', which is then gets sent back to the original sender 'test'. That account then subsequently forwarded the message to test4@domainY.pt (forwarded as 48E2929E585) which unfortunately bounced.
- does test4@domainY.pt even exists? That looks too many hops to me.
Let me know if my analysis is correct.
Quote:
Dec 6 14:37:12 remote.domainX.pt postfix/smtp[28504]: 0B8BD259F57: to=<test<a>gmail.com>, orig_to=<test<a>remote.domainX.pt>, relay=mail.domainX.pt[]:25, delay=0.1, delays=0/0.01/0.07/0.02, dsn=5.0.0, status=bounced (host mail.domainX.pt[] said: 550-Verification failed for <Xserver<a>remote.domainX.pt> 550-No Such User Here 550 Sender verify failed (in reply to RCPT TO command))
You can make your server accepts mail for any domain by using 'mydestination, virtual_alias_domains, virtual_mailbox_domains'
Your setup is pretty complex. The way I would approach it is break it down into simpler pieces first. For example:
- To begin with, I will start with the simplest, ie using local account database (ie /etc/passwd). Then upgrade that later to virtual_alias_domains or virtual_mailbox_domains.
- remove amavis or any milter for now.
- if local account to local account forwarding is still a requirement, I'll set it up and make sure that it is not looping.
- I would setup mail.domainY.pt and make sure that user@domainY.pt exists AND is accepting email.
- test that with telnet or whatever tools. Then check if mails are get delivered to its mailbox.
- In short, I will configure 1 server at a time before I proceed to server-to-server communication.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.