You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When attempting to send mail to smtp.socketlabs.com, we get the following exception:
Status Code: 20
Error Code:UnexpectedStatusCode
Full Exception:
MailKit.Net.Smtp.SmtpCommandException: r4.us-east.aws.in.socketlabs.com Hurricane Server ESMTP service ready.
at MailKit.Net.Smtp.SmtpClient.<ConnectAsync>d__70.MoveNext() in D:\TEMP\Versions\MailKit\MailKit\Net\Smtp\SmtpClient.cs:line 1061
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at ScratchPad.Classes.Mailer.<SendEmail>d__0.MoveNext() in D:\DEVELOPMENT\ScratchPad\ScratchPad\Classes\MailKit.cs:line 37
However, when adding logging to the server we get the correct status code response of 220.
Connected to smtps://smtp.socketlabs.com:465/
S: 220 r4.us-east.aws.in.socketlabs.com Hurricane Server ESMTP service ready.
To Reproduce
Attempt to send mail using smtp.socketlabs.com over port 445
On connection, see error.
Below is the code used to reproduce the behavior:
using System.Net.Mail;using MailKit.Net;using MailKit.Security;using MailKit;using MailKit.Net.Smtp;varmsg=new MailMessage();
msg.Subject ="Test Message";
msg.From =new MailAddress("test@test.com");
msg.To.Add("send@example.com");
msg.Body ="This is a test of the sending";varopt= SecureSocketOptions.SslOnConnect;try{using(varclient=new MailKit.Net.Smtp.SmtpClient(new ProtocolLogger(Console.OpenStandardOutput()))){await client.ConnectAsync("smtp.socketlabs.com",465, opt);if(client.Capabilities.HasFlag(SmtpCapabilities.Authentication))await client.AuthenticateAsync("username","password");await client.SendAsync((MimeKit.MimeMessage)msg);await client.DisconnectAsync(true);}}catch(SmtpCommandExceptione){
Console.WriteLine($"Status Code: {e.StatusCode}\r\nError Code:{e.ErrorCode}\r\n\r\nFull Exception:\r\n{e}");}catch(Exceptionex){
Console.WriteLine(ex);}
Expected behavior
Connection should be established without issue
Desktop (please complete the following information):
OS: Windows 10
Browser: Console App, .NET 4.6.2
Version 2.13
Additional context
In debugging the source code, it appears that we are receiving the response in piecemeal format (i.e. I get the "2" first, then the rest of the "20 r4.us-east.aws.in.socketlabs.com Hurricane Server ESMTP service ready."), which parses to an invalid code of 20 instead of the full 220. I believe we need to append to input when reading the response from the server
The text was updated successfully, but these errors were encountered:
I had removed the logic to preserve that remaining input data thinking that it never would get hit (unlike in POP3 and IMAP), but I had forgotten that the leading integer code might be sent as multiple packets as well.
Describe the bug
When attempting to send mail to smtp.socketlabs.com, we get the following exception:
However, when adding logging to the server we get the correct status code response of
220
.To Reproduce
Below is the code used to reproduce the behavior:
Expected behavior
Connection should be established without issue
Desktop (please complete the following information):
Additional context
In debugging the source code, it appears that we are receiving the response in piecemeal format (i.e. I get the "2" first, then the rest of the "20 r4.us-east.aws.in.socketlabs.com Hurricane Server ESMTP service ready."), which parses to an invalid code of 20 instead of the full 220. I believe we need to append to
input
when reading the response from the serverThe text was updated successfully, but these errors were encountered: