Skip to content
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

SmtpProtocolException with a new SmtpClient connection. #187

Closed
Didacuss opened this issue May 12, 2015 · 11 comments
Closed

SmtpProtocolException with a new SmtpClient connection. #187

Didacuss opened this issue May 12, 2015 · 11 comments
Labels
bug Something isn't working

Comments

@Didacuss
Copy link

Hi, I have an exception in the version 1.0.15.0 and 1.0.16.0, when I try to use a new SmtpClient connection. I have no exception with 1.0.14.0 version.

Here there is the code:

using (var smtp = new MailKit.Net.Smtp.SmtpClient()) {
smtp.Connect("sendm.intra.cciaa.net", 25, false);
}

... and here there is the exception:

SmtpProtocolException: {"Unable to parse status code returned by the server."}

in MailKit.Net.Smtp.SmtpStream.ReadResponse(CancellationToken cancellationToken)
in MailKit.Net.Smtp.SmtpClient.SendCommand(String command, CancellationToken cancellationToken)
in MailKit.Net.Smtp.SmtpClient.SendEhlo(Boolean ehlo, CancellationToken cancellationToken)
in MailKit.Net.Smtp.SmtpClient.Ehlo(CancellationToken cancellationToken)
in MailKit.Net.Smtp.SmtpClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
in MailKit.MailService.Connect(String host, Int32 port, Boolean useSsl, CancellationToken cancellationToken)
in ConsoleApplication3.Program.Main(String[] args) in f:\Devstudio\Download\Dal Papa\ConsoleApplication3\ConsoleApplication3\Program.cs:riga 56
in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()

Have you any idea about this?
Thanks in advance.
Regards.

Diego Paroiln.

@amellini
Copy link

Same error there .... I've rolled back to previous version and all worked fine.

@jstedfast
Copy link
Owner

Can you guys get me a protocol log? Without it, this will be impossible to debug.

@jstedfast
Copy link
Owner

nevermind, I can reproduce with gmail

@fenzad
Copy link

fenzad commented May 12, 2015

This work: smtp.Connect("sendm.intra.cciaa.net", 25, MailKit.Security.SecureSocketOptions.None);

@jstedfast jstedfast added the bug Something isn't working label May 12, 2015
@jstedfast
Copy link
Owner

Just released 1.0.17 with the fix

@JCCabili
Copy link

JCCabili commented Jan 5, 2018

I am having this issue on 2.0

SmtpProtocolException: Unable to parse status code returned by the server.

MailKit.Net.Smtp.SmtpStream+d__54.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
MailKit.Net.Smtp.SmtpStream.ReadResponse(CancellationToken cancellationToken)
MailKit.Net.Smtp.SmtpClient+d__69.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
MailKit.Net.Smtp.SmtpClient.Connect(string host, int port, SecureSocketOptions options, CancellationToken cancellationToken)
TechnicalSupportService.Pages.Troubleshoots.CloseTicketModel+d__28.MoveNext() in CloseTicket.cshtml.cs
+
client.Connect("mail.sistemaxtech.com", 110, MailKit.Security.SecureSocketOptions.Auto);
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNetCore.Mvc.RazorPages.Internal.ExecutorFactory+GenericTaskHandlerMethod+d__4.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNetCore.Mvc.RazorPages.Internal.ExecutorFactory+GenericTaskHandlerMethod+d__3.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker+d__29.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker+d__31.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.RazorPages.Internal.PageActionInvoker+d__22.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__22.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__17.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__15.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Builder.RouterMiddleware+d__4.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+d__6.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware+d__7.MoveNext()
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+d__7.MoveNext()

@jstedfast
Copy link
Owner

Can't solve the problem without a protocol log.

@jstedfast
Copy link
Owner

This is the problem: client.Connect("mail.sistemaxtech.com", 110, MailKit.Security.SecureSocketOptions.Auto);

You are connecting to a POP3 server using the SMTP client. That won't work.

@JCCabili
Copy link

JCCabili commented Jan 5, 2018

I am very sorry but I'm new on Mail Services so what should I do ?

@jstedfast
Copy link
Owner

Try connecting to port 25 or 587... or 465 (SSL port)

@JCCabili
Copy link

JCCabili commented Jan 5, 2018

Thank you jstedfast I already fix it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants