jhuckaby / logalert

Monitor logs (or any text files) and send alerts on specific changes.
Other
26 stars 11 forks source link

Error sending email #1

Closed guzzard closed 2 years ago

guzzard commented 2 years ago

Hi, really great tool! Was easy to configure, and log events are captured correctly.

However, I get an error message when it tries to send email: [2021-11-06 14:56:24][Test Monitor][ERROR: Failed to send e-mail: Error: 6596:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\pkg-fetch\precompile\node\deps\openssl\openssl\ssl\record\ssl3_record.c:332: ][]

This is trying to send email through outlook.com with below settings:

"mail_settings": { "host": "smtp-mail.outlook.com", "port": 587, "secure": true, "auth": { "user": "user@email.com", "pass": "password" }, "from": "user@email.com" },

OS: Windows server 2019

jhuckaby commented 2 years ago

Hey @guzzard,

I have never seen that error before, but I suspect it has something to do with the fact that LogAlert's Windows EXE was published last year, and using Node.js v12. I have just released a new version, which uses Node.js v16 (the latest stable release). I'm hoping that this version has more modern SSL libraries.

Can you possibly upgrade LogAgert on your Windows machine and try to send e-mail again? All you need is the new EXE (your config file can remain the same):

https://github.com/jhuckaby/logalert/releases/latest/download/logalert-win.exe

Thanks.

guzzard commented 2 years ago

Thanks for getting back to me @jhuckaby! :slightly_smiling_face:

I tried the new version, but unfortunately the same error, but different path in the message.

[2021-11-06 22:56:25][Test Monitor][ERROR: Failed to send e-mail: Error: 6720:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:C:\Users\runneradmin\AppData\Local\Temp\pkg.a013bbf541542f5f08b5cb23\node\deps\openssl\openssl\ssl\record\ssl3_record.c:332: ][]

Perhaps related to encryption type used? I didn't see any way of configuring what encryption to use so I assumed it was based on port where 587 normally is STARTTLS and 465 normally is SSL/TLS. Outlook.com smtp server expects STARTTLS.

jhuckaby commented 2 years ago

Ugh, I'm sorry that didn't work. You'll have to forgive me, but I don't know anything about Outlook Mail or Windows. I use a Mac, and I'm using a packager called pkg which compiles LogAlert into a Windows EXE -- but I have way to actually test it myself.

LogAlert doesn't actually send e-mail itself. It uses a 3rd party module called nodemailer. I found this excerpt from their documentation on STARTTLS:

https://nodemailer.com/smtp/

secure – if true the connection will use TLS when connecting to server. If false (the default) then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false

It sounds like you may be using port 587? So it sounds like maybe you should set the secure property to false?

Good luck!

guzzard commented 2 years ago

@jhuckaby thanks! That solved the issue and email was sent :+1:

Perhaps that just need to be clarified in the docs in some way..

Thanks again for an awesome tool :+1: :slightly_smiling_face: