Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMTP email #11210

Closed
3 tasks done
j-kia opened this issue Jan 22, 2022 · 9 comments
Closed
3 tasks done

SMTP email #11210

j-kia opened this issue Jan 22, 2022 · 9 comments

Comments

@j-kia
Copy link

j-kia commented Jan 22, 2022

Preflight Checklist

Describe the Bug

Email connection fails when I'm using email service

To Reproduce

I want to use TLS so set SMTP Secure to true (I also tried port 465)

EMAIL_TRANSPORT: 'smtp'
EMAIL_FROM: 'kurs@axelina.com'
EMAIL_SMTP_HOST: 'smtp-relay.gmail.com'
EMAIL_SMTP_PORT: 25
EMAIL_SMTP_USER: ***********
EMAIL_SMTP_PASSWORD: *********
EMAIL_SMTP_SECURE: 'true'

Errors Shown

Error when EMAIL_SMTP_SECURE is true

[Error: 139748882389808:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
] {
  library: 'SSL routines',
  function: 'ssl3_get_record',
  reason: 'wrong version number',
  code: 'ESOCKET',
  command: 'CONN'
}
10:00:51 🚨 139748882389808:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:
 
Error: 139748882389808:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

10:00:51 ✨ request errored POST 500 /email/admin 166ms
10:00:51 ⚠️  Email connection failed:
10:00:51 ⚠️  139748882389808:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

What version of Directus are you using?

9.4.3

What version of Node.js are you using?

16.13.1

What database are you using?

MySql

What browser are you using?

Any browser

What operating system are you using?

linux

How are you deploying Directus?

Docker

@jamescammarano
Copy link
Contributor

jamescammarano commented Jan 22, 2022

I followed instructions also using a google email. Here is my config:

EMAIL_FROM="<MY_OTHER_EMAIL>@gmail.com"
EMAIL_TRANSPORT="smtp"

# ## Email (SMTP Transport)
# EMAIL_SMTP_POOL=true
EMAIL_SMTP_HOST="smtp.gmail.com"
EMAIL_SMTP_PORT=465
# EMAIL_SMTP_IGNORE_TLS=false
EMAIL_SMTP_USER="<MY_EMAIL>@gmail.com"
EMAIL_SMTP_PASSWORD="<APP_SPECIFIC_PASSWORD>"
EMAIL_SMTP_SECURE=true # Use TLS

I tested the mailing ability through an @mention in a comment on an item.

It was able to send and I was able to receive it. I did have to set an app-specific password through google but that didn't give me the same error.
https://support.google.com/mail/?p=InvalidSecondFactor

With port 25 I got:

[INTERNAL_SERVER_ERROR] connect ETIMEDOUT 209.85.232.109:25

Which was also not your error.

Is there a specific place you were using the email system?

@j-kia
Copy link
Author

j-kia commented Jan 22, 2022

Is there a specific place you were using the email system?

I get this error all the time wherever i want to use the email service. When sending invitation mail with directus app or using MailsService in custom endpoints to send email with template

@rijkvanzanten
Copy link
Member

@j-kia Try setting EMAIL_SMTP_SECURE to false. When false, nodemailer will automatically decide whether or not to use SSL based on the host used

@j-kia
Copy link
Author

j-kia commented Jan 23, 2022

Try setting EMAIL_SMTP_SECURE to false. When false, nodemailer will automatically decide whether or not to use SSL based on the host used

I set it to false and get Connection timeout error

@j-kia
Copy link
Author

j-kia commented Jan 23, 2022

I updated openssl and now it doesn't give me the wrong version number error, Now i just have Connection timeout error no matter setting EMAIL_SMTP_SECURE to true or false .

@jamescammarano
Copy link
Contributor

Did you change your port back to 465? I got that error on port 25.

@j-kia
Copy link
Author

j-kia commented Jan 23, 2022

@jaycammarano yes you're right, I was using port 25, I change it to 465 and now i get:

Invalid login: 535-5.7.8 Username and Password not accepted.

I checked username and password and it was correct. it seems i should allow less secure app in my account settings.
I will let you know if the problem is solved by doing this.

@jamescammarano
Copy link
Contributor

@jaycammarano yes you're right, I was using port 25, I change it to 465 and now i get:

Invalid login: 535-5.7.8 Username and Password not accepted.

I checked username and password and it was correct. it seems i should allow less secure app in my account settings. I will let you know if the problem is solved by doing this.

Did you set an app-specific password with Google? I had to do that.

@rijkvanzanten
Copy link
Member

It sounds to me like this is most likely a configuration issue, lets keep this discussion going in Discussions 👍🏻

@directus directus locked and limited conversation to collaborators Jan 24, 2022
@rijkvanzanten rijkvanzanten converted this issue into discussion #11236 Jan 24, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants