drewr / postal

Clojure email support
MIT License
586 stars 85 forks source link

How to get TLS for gmail to work?? #83

Open jsa-aerial opened 7 years ago

jsa-aerial commented 7 years ago

I see in the README that STARTTLS and TLS is supposed to be supported. I read issue #7 and the old pull #11 that looked to solve this. But I cannot get gmail to accept this using any 'obvious' combination of parameters in the arguments map. In particular, using just :port 587 results in

SMTPSendFailedException 530 5.7.0 Must issue a STARTTLS command first.

Using :tls true results in same error as using :ssl true or both :ssl true and :port 587 result in 'less secure app' error => google thinks tls is not being used.

Looking at support.clj, it looks like there is some way to enable this as there are indications that starttls.enable can be activated, but the how of doing this is totally opaque to me.

Any suggestions / answers?

Thanks

drewr commented 7 years ago

You probably have two-factor auth enabled on your account. Can you try enabling app passwords in your Google account and create one for using Gmail through SMTP?

jsa-aerial commented 7 years ago

Do not have two step verification on. The error does not involve passwords, it involves so called 'less secure apps', which are 'defined' as using 'less secure sign-in technology', which seems to mean - not using TLS. If you turn on/enable 'Allow less secure apps' using :ssl true, works. If this is off (disabled) you nothing seems to work, including :tls true and :port 465. When using :port 465 alone, the error says you need to issue STARTLS. You would think that enabling TLS would fix this, but assuming :tls true enables it, the error still talks about 'less secure app' not allowed.

burhanloey commented 6 years ago

Same happened to me when I was trying to use :tls, I just changed to :ssl however because according to here, Google use TLS even for SSL port. I guess that's fine.

mrkam2 commented 3 years ago

These are the settings that worked for me but I also needed to enable access "for less secure apps":

{:host "smtp.gmail.com"
 :user (get-user)
 :pass (get-password)
 :ssl true}