Postfix as SMTP server for Gmail. ("Send mail as" google option)

5,367

Add the following lines to main.cf and restart the postfix

smtp_tls_security_level = may
smtp_tls_protocols = !SSLv2, !SSLv3
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
smtp_tls_mandatory_ciphers = high

For debugging you can use

smtp_tls_loglevel = 1 
Share:
5,367

Related videos on Youtube

Sam
Author by

Sam

Updated on September 18, 2022

Comments

  • Sam
    Sam almost 2 years

    I have a vps on ovh.com runing debian 7. I want to set up my gmail account to send, and recieve mail on (for example) [email protected] address. I searched google for hours and couldn't find a solution to my problem. I need a tutorial on how to set it up.

    I've already configured postfix to forward mails sent to [email protected] using this guide.

    I receive mails, but they're unencrypted. Gmail displays a warning saying that ip-xxx-xx-xx.net (ovh provided i guess) did not encrypt this message. It seems that i have tls not configured.

    My domain is configured as it should (i think) - example.com MX pointing at mail.example.com and mail.example.com A pointing at myserverip.

    I tried to add smtp server to google (send mail as) and it sees the server on port 25 (postfix default) but it displays error:

    Authentication failed. Please check your username/password. [Server response: 535 5.7.8 Error: authentication failed: authentication failure code(535)

    So i need a tutorial which will guide me on how to set up postfix as SMTP server that i can add to my gmail account, so i can send emails from gmail using my alias (myname.example.com), receive on this adress with encryption.

    UPDATE

    I changed something and it seems like there is some authentication error. Google greets me with something like this :

    Authentication failed. Please check your username/password. [Server response: Unspecified Error (SENT_SECOND_EHLO): Smtp server does not advertise AUTH capability code(0) ]

    • Steven Hook
      Steven Hook about 4 years
      I'm having the same problem. There are plenty of posts about using Gmail as an SMTP server, but nothing for this. Did you find a solution?
  • Sam
    Sam over 8 years
    I added this, and now it seems like i don't have some kind of EHLO encription or something.
  • ALex_hha
    ALex_hha over 8 years
    It would be great if you add some postfix log
  • Steven Hook
    Steven Hook about 4 years
    I'm trying to do the same thing. My logs look like this (stripped out dates, times, ips): connect from mail-ua1-f41.google.com Anonymous TLS connection established from mail-ua1-f41.google.com: TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) warning: mail-ua1-f41.google.com: SASL PLAIN authentication failed: lost connection after AUTH from mail-ua1-f41.google.com disconnect from mail-ua1-f41.google.com ehlo=2 starttls=1 auth=0/1 commands=3/4