Cloud9Developer / Jellyfin-Newsletter-Plugin

GNU General Public License v3.0
66 stars 7 forks source link

Can't send SMTP to an in house exchange server #66

Open WibblyGhost opened 7 months ago

WibblyGhost commented 7 months ago

We have a local MS Exchange Server + MailMarshal which doesn't seem to like the connection methods that you're software provides. Most SMTP setups from other software solutions work with our SMTP server but in this case doesn't. I suspect the SMTP client you're using doesn't completely support the full SMTP protocol including SSL fallback.

I noticed that you have set EnableSSL = true, although some people's setups might not use SSL or different forms of SSL, similarly menioned in another issue here https://github.com/Cloud9Developer/Jellyfin-Newsletter-Plugin/issues/62. Ontop of this I believe the SMTP protocol is supposed to allow for fallback onto the non SSL channel as explained similarly here link.

MailMarshal Logs

02080 09:07:25.029 Accepted [202.xxx.xxx.xxx(Public IP)]:60370 on interface [192.xxx.xxx.xxx(Private IP)]:25 (1 of 50 active), Total active 1. Assigning thread 2316
02316 09:07:25.029 Thread 2316 running on 8 Dec 2023 (using v8.0.1.10124) for new message.
02316 09:07:25.029 <202.xxx.xxx.xxx(Public IP)> [DOS] connection attempts incremented. Current connection attempts: 2
02316 09:07:25.029 TX: <220 smtp.somemailserver.co.nz ESMTP Trustwave SEG Ready>
02316 09:07:25.029 RX: <EHLO JellyfinMediaServer>
02316 09:07:25.029 <202.xxx.xxx.xxx(Public IP)> has a PTR record, but does not match HELO string <JellyfinMediaServer>, accepting anyway

Ptrs = smtp.somemailserver.co.nz 
02316 09:07:25.029 TX: <250-smtp.somemailserver.co.nz Hello JellyfinMediaServer(202.xxx.xxx.xxx(Public IP))

250 SIZE

>
02316 09:07:25.029 Error talking to client 202.xxx.xxx.xxx(Public IP)
Socket closed unexpectedly
02316 09:07:25.029 Thread exiting for 202.xxx.xxx.xxx(Public IP) after 0 millisecs

Debug Newsletter logs

[NLP]: [2023-12-08] :: [09:07:27] - [INFO] Sending out test mail!
[NLP]: [2023-12-08] :: [09:07:27] - [ERR] An error has occured: System.Net.Mail.SmtpException: Server does not support secure connections.
   at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
   at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
   at System.Net.Mail.SmtpClient.GetConnection()
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at Jellyfin.Plugin.Newsletters.Emails.EMAIL.Smtp.SendTestMail()

Also it would be nice to have more debug logs on what the server responses are here, rather than just saying Server does not support secure connection as this is unhelpful.

Let me know whether there is anything I can do to help get this working on our server.