Answer the question
In order to leave comments, you need to log in
How to properly configure gmail relay in postfix to send to *@gmail.com domain?
Good day.
For the 3rd day I have been trying to configure postfix so that all sent letters from my mail server are sent directly, and letters to the @gmail.com domain use gmail relay. The reason is that gmail often turns my emails into spam.
I set up postfix: DKIM, SPF and DMARC - everything is valid and on the mail test I get 10/10, but emails on gmail still go to spam. Unfortunately, I'm very poorly versed in mail servers and can't set up relay.
Here's what I do:
1. Created a sasl_passwd file with the content:
[smtp.gmail.com]:587 [email protected]:mypassword
2. Created a transport file with the content:
gmail.com smtp:[smtp.gmail.com]: 587
3. Created a free SSL certificate on WoSign
4. Added instructions to /etc/postfix/main.cf
smtpd_tls_req_ccert = yes
smtp_sasl_auth_enable = yes
smtp_use_tls = yes
transport_maps = hash: /etc/postfix/transport
smtp_tls_security_level = may
smtp_enforce_tls = yes smtp_sasl_password_maps
=
hash: /etc/postfix/sasl_passww
noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_security_level = may
5. Changed certificate permissions to 400
6. Made postmap to sasl_passwd and transport
7. Restarted postfix
When I try to send mail to gmail, I get the following log:
Apr 6 08: 32:40 changedmail postfix/pickup[2479]: 794EF2345C: uid=0 from=
Apr 6 08:32:40 changedmail postfix/cleanup[2517]: 794EF2345C: message-id=<[email protected]>
Apr 6 08:32:40 changedmail opendkim[1008]: 794EF2345C: DKIM-Signature field added ( s=mail, d=changedname.com)
Apr 6 08:32:40 changedmail postfix/qmgr[2480]: 794EF2345C: from=, size=422, nrcpt=1 (queue active)
Apr 6 08:32:40 changedmail postfix /smtp[2519]: Untrusted TLS connection established to smtp.gmail.com[74.125.129.108]:587: TLSv1.2 with cipher ECDHE-RSA$
Apr 6 08:32:41 changedmail postfix/smtp[2519]: 794EF2345C: SASL authentication failed; server smtp.gmail.com[74.125.129.108] said: 534-5.7.14 , relay=none, delay=1.2, delays=0.09/0.03/1/0, dsn=4.4.1, status=de$
Tell me where Am I wrong or in what direction should I look further for information?
Thanks a lot.
Answer the question
In order to leave comments, you need to log in
Everything turned out to be much easier than I thought.
https://www.google.com/settings/security/lesssecureapps - enable less secure authentication for the account. This method is not the most secure, it is better to set up 2-factor authentication and get a special password.
postmap hash:/etc/postfix/sasl_passwd
Did you?
postfix/smtp: SASL authentication failed; server smtp.gmail.comreports that he cannot log in to smtp.gmail.com
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question