-
Notifications
You must be signed in to change notification settings - Fork 0
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
Answer EHLO #7
Comments
Interesting. Unfortunately I'm not equipped to test this myself, but the send process is entirely handled by the .NET SmtpClient. The server is referenced and the send operation happens here in https://github.com/MV10/UPSMonitor/blob/master/UPSMonitorService/InjectedServices/Notify.cs#L85 using var smtp = new SmtpClient(config.Email.MailServerDomain, config.Email.MailServerPort);
smtp.EnableSsl = config.Email.UseTLS;
smtp.Credentials = config.Email;
await smtp.SendMailAsync(email); The problem might be in the .NET client. Microsoft actually recommends against using it since it's inefficient and doesn't support a lot of newer standards -- not that any of those apply here. Looking at the other piece of the puzzle, I'd be even more surprised if the CRLF is added when config is read, that also uses .NET's off-the-shelf config-to-class mapping code in the https://github.com/MV10/UPSMonitor/blob/master/UPSMonitorService/InjectedServices/Config.cs#L17 Email = config.GetSection("Email").Get<EmailConfig>(); If you're a developer, you might try adding a line at the end of the Email.MailServerDomain = Email.MailServerDomain.Replace("\r","").Replace("\n",""); If that works, I'll either accept a PR or make the change myself and drop a new release. I was thinking about bumping this to .NET8 anyway. If that doesn't work, I suppose we could try a third-party mail client (MS recommends MailKit although it's relatively huge). Let me know if you have the ability to test code changes. If not, I'll drop a binary here for you to test. |
I'm not a developer, if you send me a binary, I will be grateful |
I built a new binary for the Windows service -- execute However, I don't expect this to fix anything. SMTP commands are required to end with a CRLF sequence, per the RFC section 2.3.8, and section 4.1.1.1 specifically shows EHLO sequences ending with CRLF. I also can't find any other mention of this problem and the .NET classes for this are very old and haven't changed in a long time. Obvious question: I assume you're using this mail server successfully with other SMTP clients? I think it's probably something with your mail server, but it's easy enough to try the fix I mentioned. If this doesn't work, I'm willing to update the project to use the third-party library recommended by MS, but that will take some time. Please let me know the results either way. |
Thank you for your response. The error remains. |
Ok. I'll keep this open and ping you again when I update to the other mail client, in case you want to try again. I'd be wary of the APS products. They were bought by another company and most of the older apps will be discontinued early next year. The newer ones, well ... I wasn't too impressed. There are details in my article (linked in the README) about this application, if you haven't read that yet. Anyway -- thanks for reporting this and good luck! |
Thanks, it works when using public mail. But I have my own mail server installed. When launched, the utility passes an incorrect host name. The host is mfu, the utility sends the name mfu\r\n, postfix responds with EHLO mfu\r\n, the utility says
WARNING: Email failed, disabled until next restart. The server returned an invalid response to the EHLO command.
Can this be fixed somehow?
The text was updated successfully, but these errors were encountered: