Discussion:
Need help getting postfix to relay to Office 365 connector
(too old to reply)
c***@gmail.com
2016-10-26 18:25:29 UTC
Permalink
I am trying to set up an SMTP relay server so that my printers and applications can send email notifications to my local users. We use office 365 for email.

When I do a test email:
echo "This is a postfix relay test" | mail -s "This is a relay test at 1345hr" ***@mymaildomain.com

I get this error in my mail.log file
Oct 26 14:00:01 RRHALSMTPR postfix/smtp[2619]: C6893560964: to=<***@myrelayserver.internaldomain.org>, relay=my-com.mail.protection.outlook.com[216.32.180.10]:25, delay=2.1, delays=0.02/0.12/0.46/1.5, dsn=2.6.0, status=sent (250 2.6.0 <20161026175959.C6893560964myrelayserver.internaldomain.org> [InternalId=100210176950275, Hostname=BY2PR09MB096.namprd09.prod.outlook.com] 8434 bytes in 0.439, 18.726 KB/sec Queued mail for delivery)
Oct 26 14:00:01 RRHALSMTPR postfix/qmgr[2601]: C6893560964: removed

As you can see it is sending the wrong recipient to office365 (to=<***@myrelayserver.internaldomain.org) it should be send to ***@mymaildomain.com

####
Here is my main.cf
readme_directory = no

# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/o365relay.cert
smtpd_tls_key_file = /etc/ssl/private/o365relay.key
smtp_always_send_ehlo = yes
smtp_sasl_auth_enable = no
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = encrypt
smtpd_tls_security_level = encrypt
smtp_generic_maps = hash:/etc/postfix/generic
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_pix_workarounds = delay_dotcrlf
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = myrelayserver.internaldomain.org
mydomain = mymaildomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = myrelayserver.mymaildomain.com, mymaildomain.com, localhost.mymaildomain.com, localhost
relayhost = [my-com.mail.protection.outlook.com]
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
c***@gmail.com
2016-10-26 23:37:58 UTC
Permalink
Post by c***@gmail.com
I am trying to set up an SMTP relay server so that my printers and applications can send email notifications to my local users. We use office 365 for email.
I get this error in my mail.log file
Oct 26 14:00:01 RRHALSMTPR postfix/qmgr[2601]: C6893560964: removed
####
Here is my main.cf
readme_directory = no
# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/o365relay.cert
smtpd_tls_key_file = /etc/ssl/private/o365relay.key
smtp_always_send_ehlo = yes
smtp_sasl_auth_enable = no
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = encrypt
smtpd_tls_security_level = encrypt
smtp_generic_maps = hash:/etc/postfix/generic
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_pix_workarounds = delay_dotcrlf
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = myrelayserver.internaldomain.org
mydomain = mymaildomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = myrelayserver.mymaildomain.com, mymaildomain.com, localhost.mymaildomain.com, localhost
relayhost = [my-com.mail.protection.outlook.com]
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
I was able to solve my problem by setting the mydestination to empty i.e. mydestination =
Loading...