How can I configure Postfix to send all email through my Gmail account?

Solution 1:

You need to enable TLS in Postfix's SMTP client, since Google requires it. This is indicated by them in the message "Must issue a STARTTLS command".

In /etc/postfix/main.cf, you want something like this:

smtp_tls_policy_maps = hash:/etc/postfix/tls_policy

and then in /etc/postfix/tls_policy:

[smtp.gmail.com]:587 encrypt

The left hand side in tls_policy must appear exactly the same as your relayhost entry in main.cf.

Remember to run postmap on /etc/postfix/tls_policy after creating or changing it as required.

You can find more details in Postfix's TLS documentation.

Solution 2:

This very simple tutorial helped me a lot to do it.

It gives quite the same info but it worked for me.