Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need help getting postfix to relay to Office 365 connector

243 views
Skip to first unread message

chefm...@gmail.com

unread,
Oct 26, 2016, 2:25:30 PM10/26/16
to
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" first.l...@mymaildomain.com

I get this error in my mail.log file
Oct 26 14:00:01 RRHALSMTPR postfix/smtp[2619]: C6893560964: to=<m...@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=<m...@myrelayserver.internaldomain.org) it should be send to first.l...@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

chefm...@gmail.com

unread,
Oct 26, 2016, 7:38:00 PM10/26/16
to
I was able to solve my problem by setting the mydestination to empty i.e. mydestination =
0 new messages