Sending mail from a printer, scanner, or app

You can set up your on-premises multifunction printer, scanner, fax, or application to send email through Google Apps. The three available options are: SMTP relay service, Gmail SMTP server and Restricted Gmail SMTP server.

However, SMTP relay service is the best option recommended by Google and has the highest outgoing email thresholds.

SMTP relay service – used to send mail from your organization by authenticating your domain’s IP address. Allows you to send messages to anyone inside or outside of your domain.

Postfix: Configuring Gmail as Relay

Matt Hawthorne has an excellent tutorial:

1. Edit /etc/postfix/main.cf

# sets gmail as relay
relayhost = [smtp.gmail.com]:587

#  use tls
smtp_use_tls=yes

# use sasl when authenticating to foreign SMTP servers
smtp_sasl_auth_enable = yes 

# path to password map file
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

# list of CAs to trust when verifying server certificate
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

# eliminates default security options which are incompatible with gmail
smtp_sasl_security_options =

If you need further debugging you can add these:

debug_peer_list=smtp.gmail.com
debug_peer_level=3

2. Add Gmail creds to /etc/postfix/sasl_passwd

[smtp.gmail.com]:587  username:password

3. Run sudo postmap /etc/postfix/sasl_passwd

Make sure the /etc/sasl_passwd* files are owned by the postfix user:

sudo chown postfix sasl_passwd*

4. Run /etc/init.d/postfix reload

Troubleshooting

1. No TLS:

status=bounced (host smtp.gmail.com[74.125.65.109] said: 530 5.7.0 Must issue a STARTTLS command first. s9sm727762ybm.8 (in reply to MAIL FROM command))

You’re missing smtp_use_tls=yes in main.cf

2. Unknown CA:

certificate verification failed for smtp.gmail.com[74.125.47.109]:587: untrusted issuer /C=US/O=Equifax/OU=Equifax Secure Certificate Authority

You’re missing smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt in main.cf


Additional Online Resources (Untested)
  • How To Relay Postfix mails via smtp.gmail.com on Ubuntu 14.04.1
  • Using Gmail with Postfix as an SMTP relay