hargata/lubelog

SMTP not working with Proton Mail

Closed this issue · 47 comments

As the title states I am having issues getting SMTP to work through ProtonMail. I have tried every combination of ssl on/off and ports. Sometimes I get an error other times no error but I don't receive the emails. Nothing is showing in the logs either so I can;t pin point exactly what is wrong.

Any help is much appreciated.

Thank you

Sorry I don't have a way to test this out as ProtonMail SMTP is only available to their business users. Maybe someone else can chime in on this.

No worries! I appreciate you getting back so quickly

If needed I can always provide a test account with an app password for proton mail

@Cyberlytical-LLC that works, shoot me an email over at hargatasoftworks@gmail.com

Is there a way to do starttls? I am think that may be the issue. Or maybe plaintext auth?

@Cyberlytical-LLC I have tested with the credentials you sent me. You're right, the problem lies with the SMTP Client provided by .NET not supporting the security protocols used by ProtonMail. I'm looking at third party implementations and have found one that will work with ProtonMail, but that will require a lot of testing before I can release it.

Hey no worries! I am glad you found the issue. I am happy to run a beta build if you'd like me to test it as well.

@Cyberlytical-LLC try the :edge tagged docker image

@hargata Okay so I did "sudo docker compose down --rmi all" then "sudo docker pull ghcr.io/hargata/lubelogger:edge" and changed the .env file to the proton info. Is that all I should need to do?

yeap

I'm still getting an error.
LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 MailConfig__EmailServer="smtp.protonmail.ch" MailConfig__EmailFrom="email@cyberlytical.org" MailConfig__UseSSL="true" MailConfig__Port=587 MailConfig__Username="email@cyberlytical.org" MailConfig__Password="app password" LOGGING__LOGLEVEL__DEFAULT=Error
Are these the settings you used?

Also what is the best way to test notifications for odometer and such? I'm not getting any emails from the gmail setup or proton. Only getting the registration emails from the gmail config.

@Cyberlytical-LLC you need to update docker-compose.yml file to point at the edge tag
can you explain what you mean by notifications for odometer?

That worked! Thank you so much for getting this done so quickly.

I wanted to test reminders so I set a notification to notify me today and one when my odometer hit "10" I saved the reminders then changed my odometer to 10 but never received a notification.

I sent you a donation for all your help and being so kinda. Loving the app so far!

@Cyberlytical-LLC Thanks for the donation!

As for the reminder emails, you will need to set up a cron job to run a curl command, see example

This will send collaborators an email detailing the vehicle and the urgency of the reminder based on the interval of the cron job:

It looks like this:

image

@hargata Hmm okay. I tried running the command with the root user and a sudo user with no luck. I also added it to cron and made a executable script file and it's none of the things I try are seeming to work. I don't have logs so I'm curious what is wrong.

@Cyberlytical-LLC does the curl command return any errors at all?

@hargata it doesn't as far as I can tell it's working, just never receive an email. Could it be something with HA proxy?

potentially, it could be that the curl command isn't able to reach your lubelogger instance, usually something to do with reverse proxies.

if you replace https://lubelogger.mydomain.com with the localhost ip and port or the docker container it might work.

I would also check your authentication, can you hit other API endpoints such as /vehicles with those credentials?

So I changed the url to http://10.10.5.11:8080/api/vehicle/reminders/send?urgencies=NotUrgent&urgencies=VeryUrgent&urgencies=Urgent&urgencies=PastDue with no luck. In the browser I can hit /api but not the sting provided.

@Cyberlytical-LLC what happens when you run curl -n -u "rootUser:rootPassword" --location "https://lubelogger.mydomain.com/api/vehicles"

Curl command seems to work, but still no email. I tried with the url as well as IP

@Cyberlytical-LLC Just to confirm, you have a vehicle set up along with a reminder, and you also have a user that is added as a collaborator on that vehicle, is that correct?

Correct. Below are screenshots of the setup
image
image
image
image

Can you change the reminder metric on the test reminder so that it is in "Urgent" or "Not Urgent" status and see if that works? Some email inboxes will flag emails with the wording "Very Urgent" in it so it might not get delivered

No luck :/

I changed my proxy config to allow X-forward-for and now I can reach https://lubelog.cyberlytical.org/api/vehicle/reminders but get that error page again.

can you check the Outbox/Sent of the SMTP account and see if it actually sent those emails out?

do https://lubelog.cyberlytical.org/api/vehicle/reminders?vehicleId=1 that endpoint requires a vehicleId param

No emails being sent. That works I can see the reminders in the browser

@Cyberlytical-LLC kk now try https://lubelog.cyberlytical.org/api/vehicle/reminders/send?urgencies=NotUrgent

I just get a blank page and when I run the curl command nothing happens.
image

@Cyberlytical-LLC are you logged in as the root user?

I've tried with 2 different sudo accounts, the root account itself and by changing user to root by doing sudo su. Same results

@Cyberlytical-LLC hm? The root user for LubeLogger is the account you first set up when you enable authentication in the Settings page.

OMG I am an idiot. However after changing it to those credentials still no luck. Could it be the randomly generate password with all the symbols in it?

@Cyberlytical-LLC does it have a ":" in it?

Nope just a few "@" "#"

can you send a screenshot of what you're seeing when you navigate to https://lubelog.cyberlytical.org/api/vehicle/reminders/send?urgencies=NotUrgent while logged in as the root user?

You should see this json payload if your credentials are correct:
image

otherwise, you'll see either this:
image
or a blank screen(some browsers do not display HTTP error codes)

Right after I typed this into my browser all the emails sent,
image

The command doesn't seem to be working. Whenever I go to the url after changing the urgencies it works though. Is there a way to change the root password?

yeah, see #489

Awesome you've helped tremendously! Thank you so much for getting me setup!

No problem!