Skip to content
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 issues #517

Open
marcogiorgio opened this issue May 10, 2024 · 10 comments
Open

SMTP issues #517

marcogiorgio opened this issue May 10, 2024 · 10 comments

Comments

@marcogiorgio
Copy link

marcogiorgio commented May 10, 2024

Hi,
my .env file is as follows:

LC_ALL=it_IT.UTF-8
LANG=it_IT.UTF-8
MailConfig__EmailServer="smtp.sendgrid.net"
MailConfig__EmailFrom="info@mydomain.net"
MailConfig__UseSSL="true"
MailConfig__Port=587
MailConfig__Username="apikey"
MailConfig__Password="mypassword"
#LOGGING__LOGLEVEL__DEFAULT=Error

I am trying to test that the emails are sent out correctly by opening the page https://lubelogger.mydomain.net/api/vehicle/reminders/send?urgencies=NotUrgent while logged in with my root user. I get:

success	true
message	"Emails sent"

but I don't receive any emails... In facts, my firewall doesn't even show that an outbound connection to port 587 is being made.. I've opened a shell into the container and I am able to reach smtp.sendgrid.net at port 587.
Is there a way to debug this? I don't see anything that can help me in the app logs

Thanks

@marcogiorgio
Copy link
Author

I've re-opened the issue because I initially thought something was wrong from my end but it doesn't seem the case.

@hargata
Copy link
Owner

hargata commented Jun 6, 2024

If there are no logs or errors, that means that the email was flagged and failed by SendGrid's servers because they think it's spam. SendGrid has a very stringent filter because of historical abuse.

I would consider trying a different SMTP provider such as Gmail and see if it works, unfortunately this is beyond our control.

@hargata hargata closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2024
@marcogiorgio
Copy link
Author

Hi @hargata
But I can see from my firewall logs that a connection is made to the sendgrid server if I telnet it from the container shell, whereas when I use the API route, no external connection is made.
Furthermore, there is nothing logged in Scalegrid

@hargata
Copy link
Owner

hargata commented Jun 6, 2024

Yeah I'm not sure then. I don't have a sendgrid account to test this with. Does port 465 work?

@marcogiorgio
Copy link
Author

I don't think the problem is Scalegrid here, I've changed the SMTP config to use a Postfix relay which I am using for services that don't support authentication. Even with this one no emails are sent and no connections are made to the relay...
But I still get

success: true
message: "Emails sent"

I've tried with both

MailConfig__Username=""
MailConfig__Password=""

and also I've tried to remove them entirely

@hargata
Copy link
Owner

hargata commented Jun 6, 2024

I'm not sure then, sorry, I can't help you debug this because I don't have your exact setup.

I'll keep your issue open just in case someone else can chime in

@hargata hargata reopened this Jun 6, 2024
@marcogiorgio
Copy link
Author

Sure, no worries. I'll try to investigate more this weekend

@marcogiorgio
Copy link
Author

marcogiorgio commented Jun 8, 2024

Hi @hargata,
I managed to find the problem root cause...
Basically when I enabled the authentication feature I didn't notice that the user that you create during this process is not a "real user" (I guess this is just a wrapper for the HTTP basic auth?)...
I had to create a real user from the admin page with an email associated to it...

Anyway if I got it right, I think this is a little bit confusing, maybe it would be better to have a "full" user created when you enable authentication. In facts, I was able to create another user using the token registration functionality with the same username as the one I used when I enabled the authentication...

As a results, when I login I don't really know which user I am actually using

@johenkel
Copy link

@marcogiorgio
I am running into teh same problem it seems. I got the successful API call ( {"success":true,"message":"Emails sent"} ).
After reading your comment, I was trying to create a user in the Admin Panel page.

However I do not have a button to create a new user !?

@marcogiorgio
Copy link
Author

marcogiorgio commented Jun 19, 2024

@johenkel there is no button to create a new user in the admin page. You have to generate a token by clicking on the 'Generate user token' button.

Then you have to logout and click on 'Register' and use that token to crete a new user.

More info here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants