1. Undo all your changes to master.cf.

  2. In main.cf, add these settings:

    relayhost = [smtp.gmail.com]:587
    
    smtp_tls_security_level = verify
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
    smtp_tls_session_cache_database = btree:/var/run/smtp_tls_session_cache
    
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    
  3. In /etc/postfix/sasl_passwd, add your Gmail username and password, like this:

    [smtp.gmail.com]:587    user@gmail.com:mypassword
    
  4. Run

    postmap /etc/postfix/sasl_passwd
    postfix reload
    

Komentar