LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Closed Thread
  Search this Thread
Old 11-14-2019, 08:35 AM   #1
KamilKrK
LQ Newbie
 
Registered: Oct 2019
Posts: 7

Rep: Reputation: Disabled
Posftix - multiple relay error


Hello all,

I am trying to configure the postfix so that depending on which internal domain he got the message he sent to the appropriate smtp server. I do it on the example of gmail about O365. This is my configuration:

Code:
/etc/postfix/Main.cf
mynetworks = 127.0.0.0/8, [::ffff:127.0.0.0]/104, [::1]/128, 192.168.1.0/24, 
mydestination = $myhostname, smtprelay, localhost.localdomain, , localhost, localhost.o365.local, localhost.gmail.local
# default relayhost setting
relayhost = [smtp.gmail.com]:587
# sender-dependent sasl authentication
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
# smtp authentication settings
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_sasl_mechanism_filter = plain
transport_maps = hash:/etc/postfix/transport
--------------------------------------------------------------------------------------------------------------------------
/etc/postfix/sasl_passwd 
gmail@gmail.local   account1@gmail.com:Start321!
o365@o365.local  account1@mydomain.com:Start321!
------------------------------------------------------------------------------------------------------------------------
/etc/postfix/sender_relay 
account1@gmail.com [smtp.gmail.com]:587
account1@mydomain.com [smtp.office365.com]:587
----------------------------------------------------------------------------------------------------------------------
/etc/postfix/transport 
gmail.local     smtp:[smtp.gmail.com]:587
o365.local      smtp:[smtp.office365.com]:587
At this time, only sending from gmail@gmail.local works and for O365 there is such an error:

Code:
321D0100A34: from=<o365@o365.local>, size=422, nrcpt=1 (queue active)
Nov 14 10:30:51 smtprelay postfix/smtp[6261]: 321D0100A34: SASL authentication failed; server smtp.gmail.com[173.194.73.108] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8  https://support.google.com/mail/?p=BadCredentials i22sm2015187ljg.94 - gsmtp
Nov 14 10:30:51 smtprelay postfix/smtp[6261]: connect to smtp.gmail.com[2a00:1450:4010:c0d::6d]:587: Network is unreachable
Nov 14 10:30:51 smtprelay postfix/smtp[6261]: 321D0100A34: to=<myemail@mydomain.com>, relay=none, delay=0.43, delays=0.07/0/0.36/0, dsn=4.4.1, status=deferred (connect to smtp.gmail.com[2a00:1450:4010:c0d::6d]:587: Network is unreachable)
After hashing the entry #relayhost = [smtp.gmail.com]:587 in main.cf, nothing works and every message wants to come out via O365 but he fails.

Code:
Nov 14 10:16:08 smtprelay postfix/qmgr[5995]: 31D7F100A34: from=<o365@o365.local>, size=422, nrcpt=1 (queue active)
Nov 14 10:16:38 smtprelay postfix/smtp[6013]: connect to xxx.mail.protection.outlook.com[104.47.1.36]:25: Connection timed out

Nov 14 10:15:00 smtprelay postfix/qmgr[5995]: 560EF100A34: from=<gmail@gmail.local>, size=437, nrcpt=1 (queue active)
Nov 14 10:15:30 smtprelay postfix/smtp[6013]: connect to xxx.mail.protection.outlook.com[104.47.0.36]:25: Connection timed out
What's wrong with the configuration?
 
Old 11-14-2019, 08:56 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by KamilKrK View Post
Hello all,
I am trying to configure the postfix so that depending on which internal domain he got the message he sent to the appropriate smtp server. I do it on the example of gmail about O365. This is my configuration:
Code:
/etc/postfix/Main.cf
mynetworks = 127.0.0.0/8, [::ffff:127.0.0.0]/104, [::1]/128, 192.168.1.0/24, 
mydestination = $myhostname, smtprelay, localhost.localdomain, , localhost, localhost.o365.local, localhost.gmail.local
# default relayhost setting
relayhost = [smtp.gmail.com]:587
# sender-dependent sasl authentication
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
# smtp authentication settings
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_sasl_mechanism_filter = plain
transport_maps = hash:/etc/postfix/transport
--------------------------------------------------------------------------------------------------------------------------
/etc/postfix/sasl_passwd 
gmail@gmail.local   account1@gmail.com:Start321!
o365@o365.local  account1@mydomain.com:Start321!
------------------------------------------------------------------------------------------------------------------------
/etc/postfix/sender_relay 
account1@gmail.com [smtp.gmail.com]:587
account1@mydomain.com [smtp.office365.com]:587
----------------------------------------------------------------------------------------------------------------------
/etc/postfix/transport 
gmail.local     smtp:[smtp.gmail.com]:587
o365.local      smtp:[smtp.office365.com]:587
At this time, only sending from gmail@gmail.local works and for O365 there is such an error:

Code:
321D0100A34: from=<o365@o365.local>, size=422, nrcpt=1 (queue active)
Nov 14 10:30:51 smtprelay postfix/smtp[6261]: 321D0100A34: SASL authentication failed; server smtp.gmail.com[173.194.73.108] said: 535-5.7.8 Username and Password not accepted. Learn more at?535 5.7.8  https://support.google.com/mail/?p=BadCredentials i22sm2015187ljg.94 - gsmtp
Nov 14 10:30:51 smtprelay postfix/smtp[6261]: connect to smtp.gmail.com[2a00:1450:4010:c0d::6d]:587: Network is unreachable
Nov 14 10:30:51 smtprelay postfix/smtp[6261]: 321D0100A34: to=<myemail@mydomain.com>, relay=none, delay=0.43, delays=0.07/0/0.36/0, dsn=4.4.1, status=deferred (connect to smtp.gmail.com[2a00:1450:4010:c0d::6d]:587: Network is unreachable)
After hashing the entry #relayhost = [smtp.gmail.com]:587 in main.cf, nothing works and every message wants to come out via O365 but he fails.
Code:
Nov 14 10:16:08 smtprelay postfix/qmgr[5995]: 31D7F100A34: from=<o365@o365.local>, size=422, nrcpt=1 (queue active)
Nov 14 10:16:38 smtprelay postfix/smtp[6013]: connect to xxx.mail.protection.outlook.com[104.47.1.36]:25: Connection timed out
Nov 14 10:15:00 smtprelay postfix/qmgr[5995]: 560EF100A34: from=<gmail@gmail.local>, size=437, nrcpt=1 (queue active)
Nov 14 10:15:30 smtprelay postfix/smtp[6013]: connect to xxx.mail.protection.outlook.com[104.47.0.36]:25: Connection timed out
What's wrong with the configuration?
So you took the advice in your other (duplicate) thread about enabling transport mapping. Did you look at/think about the messages you're getting?? It's telling you very clearly that the user credentials aren't correct/accepted, and even gave you a link to look at. Did you look at it?

Also look up what the message is for O365; it's in the Microsoft knowlegebase.
 
  


Closed Thread



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
mailer=relay, pri=30008, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Con pralhad Linux - Software 1 08-11-2007 10:49 AM
HELP! with Posftix mail disappear after delivered combilli Linux - Server 0 06-13-2007 04:51 AM
Postfix as a mail relay (getting relay access denied) hypexr Linux - Software 3 09-13-2005 07:15 PM
relay mail to sendmail relay server??? lemay_jeff Linux - Newbie 0 07-06-2004 04:54 PM
Relay or not to relay? Manuel-H Linux - General 2 04-20-2003 03:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:47 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
Open Source Consulting | Domain Registration