Leave a comment
February 16, 2022 by aubreykloppers
This is actually a difficult one, as configurations change when printers gets updated, so I will try to give you a “catchall” explanation in this article.
Things to keep in mind:
- Microsoft changed TLS 1 to legacy support, so you need to enable this. Read THIS for a better understanding, but you can use:
- Use PowerShell to run the Set-TransportConfig cmdlet in the Exchange Online management module:
- Set-TransportConfig -AllowLegacyTLSClients $True
- Configure clients to use a new endpoint: smtp-legacy.office365.com.
- You can also use Postfix on a Linux machine to pass the information/prints in such a way to Office 365. To do this you need:
- A mail account that will become the “send as/from” account.
- Linux (Ubuntu or Debian) machine with root access.
- Printers changes as updates happens. I have had a “Ricoh Aficio MP 301” that forces the from address to be the same as the to address.
Steps to get Postfix to work:
Note: I am using :
- example.com my domain,
- I have 2 networks on the LAN (vpn)
- 192.168.1.0/24 and
- I am using firstname.lastname@example.org as my administrative mailbox.
- I am using 192.168.1.100 as my relay server IP address.
Use the following steps to configure your setup:
sudo apt update
sudo apt install postfix mailutils
Choose "Internet Site" as your mail configuration.
sudo apt install postfix-pcre libpcre3 libpcre2-8-0 libpcre2-16-0
sudo vi /etc/postfix/main.cf
relayhost = [smtp.office365.com]:587
myhostname = relay.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24 192.168.2.0/24
smtp_use_tls = yes
smtp_always_send_ehlo = yes
smtp_sasl_auth_enable = yes
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
smtp_generic_maps = hash:/etc/postfix/generic
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
header_checks = pcre:/etc/postfix/header_checks
sudo vi /etc/postfix/sasl_passwd
sudo chown root:root /etc/postfix/sasl_passwd
sudo chmod 0600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo vi /etc/postfix/generic
sudo chown root:root /etc/postfix/generic
sudo chmod 0600 /etc/postfix/generic
sudo postmap /etc/postfix/generic
sudo vi /etc/postfix/header_checks
/From:.*/ REPLACE From: email@example.com
sudo service postfix restart
- Points 1-3 takes care of the installation
- Point 4 the configuration of postfix
- Point 5 to 8 sets the Office 365 mailbox username and password
- Point 9 to 12 takes care of sending mail as a valid user to Office 365
- Point 13 is the most important of all the points and everybody misses this in their configurations. It takes care of the “From:” address. Even if the device forces the from address to be the same as the to address, the from address will always be changed top this address.
- Administrator email address: firstname.lastname@example.org
- SMTP Server Name: 192.168.1.100
- SMTP Port Number: 25