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) myname@example.com 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 myname@example.com 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.


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) ]

  • 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? Jun 3, 2020 at 20:09

2 Answers 2


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 
  • 1
    I added this, and now it seems like i don't have some kind of EHLO encription or something.
    – Sam
    Mar 7, 2016 at 19:46
  • It would be great if you add some postfix log
    – ALex_hha
    Mar 7, 2016 at 21:18
  • 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 Jun 3, 2020 at 20:10

All things being equal. I think what you want to do is offered by Google.

Second. This, I think, is one of the easier to follow Postfix guides: https://workaround.org/ispmail/wheezy/ <- Deb 7 https://workaround.org/ispmail/jessie <- Deb 8

That should get you a start. From there Google, man pages, & such are your friend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.