question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax error through client.send() after successful authentication

See original GitHub issue

I get a MailKit.Net.Smtp.SmtpCommandException: 'Syntax error, command unrecognized' crash on sending a message after a successful SMTP authentication.

Connected to ...
S: 220 ... ESMTP outbound-server; Fri, 21 Oct 2022 23:23:16 +0200
C: EHLO Der-Geraet
S: 250-... Hello Der-Geraet [/...] , Pleased to meet you
S: 250-DSN
S: 250-HELP
S: 250 AUTH LOGIN DIGEST-MD5 PLAIN CRAM-MD5
C: AUTH DIGEST-MD5
S: 334 ...
C: ********
S: 334 ...
C:
S: 235 Authentication successful
C: MAIL FROM:<joey@friends.com>
S: 500 Syntax error, command unrecognized
C: RSET
S: 250 Requested mail action okay, completed
Unhandled exception. MailKit.Net.Smtp.SmtpCommandException: Syntax error, command unrecognized
   at MailKit.Net.Smtp.SmtpClient.OnSenderNotAccepted(MimeMessage message, MailboxAddress mailbox, SmtpResponse response)
   at MailKit.Net.Smtp.SmtpClient.ProcessMailFromResponse(MimeMessage message, MailboxAddress mailbox, SmtpResponse response)
   at MailKit.Net.Smtp.SmtpClient.MailFromAsync(FormatOptions options, MimeMessage message, MailboxAddress mailbox, SmtpExtension extensions, Int64 size, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.SendAsync(FormatOptions options, MimeMessage message, MailboxAddress sender, IList`1 recipients, Boolean doAsync, CancellationToken cancellationToken, ITransferProgress progress)
   at MailKit.Net.Smtp.SmtpClient.SendAsync(FormatOptions options, MimeMessage message, MailboxAddress sender, IList`1 recipients, Boolean doAsync, CancellationToken cancellationToken, ITransferProgress progress)
   at MailKit.Net.Smtp.SmtpClient.Send(FormatOptions options, MimeMessage message, CancellationToken cancellationToken, ITransferProgress progress)
   at MailKit.MailTransport.Send(MimeMessage message, CancellationToken cancellationToken, ITransferProgress progress)
   at TestClient.Program.Main(String[] args) in ... .cs:line 36

I use the Sample Code for sending a message.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jstedfastcommented, Oct 23, 2022

Yea your python code is not using DIGEST-MD5.

0reactions
jstedfastcommented, Oct 24, 2022

Was at dinner before using my phone, so had to wait until now to respond with some sample code that should work just like the python code:

using (var client = new SmtpClient ()) {
    client.Connect (hostName, 465, SecureSocketOptions.SslOnConnect);

    // Enforce LOGIN authentication:
    var login = new SaslMechanismLogin (username, password);
    client.Authenticate (login);

    client.Send (message);
    client.Disconnect (true);
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

c# SMTP auth send problem Syntax error in parameter or ...
I have a method in c# that sends email. Works fine and has been working fine for two years. I ran into a...
Read more >
Handling operation errors - Apollo GraphQL Docs
These are errors related to the server-side execution of a GraphQL operation. They include: Syntax errors (e.g., a query was malformed); Validation errors...
Read more >
Everything you need to know about SMTP Error Codes
SMTP is used to send emails across the network with the help of MTA. Here in this tutorial we will go through the...
Read more >
Status codes in HTTP
Following a POST command, this indicates success, but the textual part of the response line indicates the URI by which the newly created...
Read more >
How to Fix a 400 Bad Request Error (Causes and Fixes)
1. URL String Syntax Error. The HTTP error 400 can occur due to incorrectly typed URL, malformed syntax, or a URL that contains...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found