Printers scan to email – Office 365

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:

  1. Microsoft changed TLS 1 to legacy support, so you need to enable this. Read THIS for a better understanding, but you can use:
    1. Use PowerShell to run the Set-TransportConfig cmdlet in the Exchange Online management module:
    2. Set-TransportConfig -AllowLegacyTLSClients $True
    3. Configure clients to use a new endpoint: smtp-legacy.office365.com.
  2. 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:
    1. A mail account that will become the “send as/from” account.
    2. Linux (Ubuntu or Debian) machine with root access.
  3. 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 :

  1. example.com my domain,
  2. I have 2 networks on the LAN (vpn)
    • 192.168.1.0/24 and
    • 192.168.2.0/24.
  3. I am using printers@example.com as my administrative mailbox.
  4. I am using 192.168.1.100 as my relay server IP address.

Use the following steps to configure your setup:

  1. sudo apt update
  2. sudo apt install postfix mailutils
    • Choose "Internet Site" as your mail configuration.
  3. sudo apt install postfix-pcre libpcre3 libpcre2-8-0 libpcre2-16-0
  4. 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
  5. sudo vi /etc/postfix/sasl_passwd
    • [smtp.office365.com]:587 printers@example.com:office365password
  6. sudo chown root:root /etc/postfix/sasl_passwd
  7. sudo chmod 0600 /etc/postfix/sasl_passwd
  8. sudo postmap /etc/postfix/sasl_passwd
  9. sudo vi /etc/postfix/generic
    • root@localdomain printers@example.com
    • @localdomain printers@example.com
  10. sudo chown root:root /etc/postfix/generic
  11. sudo chmod 0600 /etc/postfix/generic
  12. sudo postmap /etc/postfix/generic
  13. sudo vi /etc/postfix/header_checks
    • /From:.*/ REPLACE From: printers@example.com
  14. sudo service postfix restart

Explanation:

  1. Points 1-3 takes care of the installation
  2. Point 4 the configuration of postfix
  3. Point 5 to 8 sets the Office 365 mailbox username and password
  4. Point 9 to 12 takes care of sending mail as a valid user to Office 365
  5. 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.

Printer configuration:

  1. Administrator email address: printers@example.com
  2. SMTP Server Name: 192.168.1.100
  3. SMTP Port Number: 25

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

counter for wordpress
%d bloggers like this: