something like this *should* work. as my smarthosts are in lan, not (yet) tested.
A) Install dependencies:
apt-get install libsasl2-modules
B) Postfix :
1. Create a password file in /etc/postfix/relay_password containing SMTP host, username and password (used for submission authentication) as shown:
smtp.relaydomain.ext USERNAME
ASSWORD
2. Secure the file against unwanted modifications and readings:
chmod 600 /etc/postfix/relay_password
3. Hash the file in order to create a passwords.db file
postmap /etc/postfix/relay_passwords
4. Configure Postfix, by editing /etc/postfix/main.cf
smtp_tls_security_level = encrypt
relayhost = [smtp.relaydomain.ext]:587
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwords
smtp_sasl_security_options =
(for googlemail: smtp_tls_security_level = encrypt)
5. Restart postfix
if it works for you
Edit /var/lib/pmg/templates/main.cf.in instead of /etc/postfix/main.cf so it survives config changes.