hargata/lubelog

SMTP issues

Closed this issue · 12 comments

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

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

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.

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

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

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

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

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

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

@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 !?

@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

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

In next release, you will be able to inject a new environment variable named DEFAULT_REMINDER_EMAIL and that will allow the root user to receive reminders for all vehicles instead of having to create a new user.

@marcogiorgio

In 1.3.7, instead of having to create a new user, you can just add a Default Reminder Email in the settings tab and you will receive reminder emails for all vehicles as the root user.

image