LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums HCL Reviews Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-09-2016, 10:58 AM   #1
ApolloPT
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Rep: Reputation: Disabled
Question 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.

With getmail i was using as destination:

Code:
[destination]
type = MDA_external
path = /usr/sbin/sendmail
arguments = ("-bm", "test")
unixfrom = true
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.
 
Old 12-10-2016, 06:19 PM   #2
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 417

Rep: Reputation: 74
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.
 
Old 12-12-2016, 04:19 AM   #3
ApolloPT
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by c0wb0y View Post
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.
Here is my main.cf: http://pastebin.com/d9hZaTwp

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.

I have not tried yet with virtual_mailbox_maps.

Heres also my master.cf: http://pastebin.com/214efW42

Last edited by ApolloPT; 12-12-2016 at 04:57 AM.
 
Old 12-12-2016, 05:05 AM   #4
ApolloPT
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
I have also tried to use myhostname with domainX.pt instead of remote.domainX.pt, and it loops (mail forwarding loop).
 
Old 12-12-2016, 02:54 PM   #5
c0wb0y
Member
 
Registered: Jan 2012
Location: Inside the oven
Distribution: Windows
Posts: 417

Rep: Reputation: 74
Quote:
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.

Last edited by c0wb0y; 12-13-2016 at 01:42 AM.
 
1 members found this post helpful.
Old 12-13-2016, 07:21 AM   #6
ApolloPT
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Yes, that user exist and is functional.

Thanks for the help c0wb0y i will see what i can do.
 
  


Reply

Tags
postfix



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Forward root mail to external account requering smtp authentication.... fcintron Linux - Server 5 11-14-2012 10:59 AM
Sending root mail to an external mail account aquaboot Debian 13 01-09-2009 08:23 PM
How to configure sendmail only to send mail to external mail account Nivix Linux - Newbie 2 10-23-2008 01:46 AM
How To Forward Mail & Account Question? carlosinfl Linux - Enterprise 6 12-04-2006 05:00 PM
Postfix: Need to deliver all local mail to 1 account, then forward OneBinary Linux - Software 3 01-05-2006 05:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration