30 December, 2018

Gmail as Relay in PostFix

  1. Go to the following link: Manage your account access and security settings . Scroll down to “Password & sign-in method” and click 2-Step Verification. Then enable it.
  2. Click the following link to Generate an App password for Postfix.
  3. Click Select app and choose Other (custom name) from the drop-down menu. Enter “Postfix” and click Generate . Save the password.
  4. Log in to Plesk server using SSH.
  5. Open or create the /etc/postfix/sasl/sasl_passwd file and add the SMTP Host, username, and password information:
    [smtp.gmail.com]:587 username@gmail.com:password
    Use the password from the 3d step.
  6. Create the hash db file for Postfix by running the postmap command:
    # postmap /etc/postfix/sasl/sasl_passwd
  7. Run the following commands to change the ownership to root and update the permissions for the two files:
    # sudo chown root:root /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
    # sudo chmod 0600 /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db
  8. Find and modify relayhost in /etc/postfix/main.cf to match the following example:
    relayhost = [smtp.gmail.com]:587
    Set this in the end of /etc/postfix/main.cf file:
    # Enable SASL authentication
    smtp_sasl_auth_enable = yes 
    # Disallow methods that allow anonymous authentication 
    smtp_sasl_security_options = noanonymous 
    # Location of sasl_passwd 
    smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd 
    # Enable STARTTLS encryption 
    smtp_tls_security_level = encrypt 
    # Location of CA certificates 
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
  9. Restart Postfix:
    # service postfix restart

No comments:

Post a Comment

Redirection in IIS

 This config will redirect every request to https://www.domain.com <configuration>     <system.webServer>         <rewrite>...