Syntax error command unrecognized the server response was

I cannot send mail from a certain smtp server. If i use the SmtpClient.Send() method i'm receiving timeout exception or something like that after certain amount of time, and if i use SmtpClient.SendAsync i don't receive absolutelly nothing, the window just freezes and stays like that forever, no error, nothing. There is nothing wrong with my code, it works with other servers . Also there's nothing wrong with the server and port settings too, i tried the same settings in Outlook 2010 and Thunderbird and it works fine . Can anyone help me with that?
  • Remove From My Forums
  • Question

  • I cannot send mail from a certain smtp server. If i use the SmtpClient.Send() method i’m receiving timeout exception or something like that
    after certain amount of time, and if i use SmtpClient.SendAsync i don’t receive absolutelly nothing, the window just freezes and stays like that forever, no error, nothing. There is nothing wrong with my code, it works with other servers .
    Also there’s nothing wrong with the server and port settings too, i tried the same settings in Outlook 2010 and Thunderbird and it works fine . Can anyone help me with that?

Answers

  • vendir,

    This message is typical with SMTPS-servers that are not supported, as I already mentioned. You get something like:

    [Email] System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was:
    at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
    at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)

    May I cite from the documentation:

    «The SmtpClient class only supports the SMTP Service Extension for Secure SMTP
    over Transport Layer Security as defined in RFC 3207. In this mode, the SMTP session begins on an unencrypted channel, then a STARTTLS command is issued by the client to the server to switch to secure communication using SSL. See RFC 3207 published by the
    Internet Engineering Task Force (IETF) for more information.

    An alternate connection method is where an SSL session is established up front before any protocol commands are sent. This connection method is sometimes called SMTP/SSL, SMTP over SSL, or SMTPS and by default uses port 465.
    This alternate connection method using SSL is not currently supported.«

    SmtpClient.EnableSsl Property:
    http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.enablessl.aspx

    Sorry for not bringing any good news, but sometimes it is better to know that something simply will not work. This way you can concentrate on looking for a viable alternative. 

    Marcel

    • Marked as answer by

      Wednesday, July 28, 2010 8:22 AM

    • Marked as answer by
      Alan_chen
      Wednesday, July 28, 2010 8:22 AM

While sending mail from particular id I get this error, for rest of all id’s its working fine,
What was the problem over here..

Syntax error, command unrecognized. The server response was: 
status code :0 

stack trace:

   at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
   at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)

Brief:

 System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: 
   at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
   at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)

Please help me out..

Nagaraj S's user avatar

Nagaraj S

13.2k6 gold badges32 silver badges52 bronze badges

asked Apr 9, 2010 at 11:38

Innova's user avatar

3

This error message states «Command unrecognized»

This means «something» was not formatted correctly.

The stack trace shows where the error occurred.

The final step was ConnectAndHandshakeAsyncResult

This is happening at the server level.

The message passed to the mail server is messed up.

answered Jan 17, 2014 at 7:00

Dan But's user avatar

Dan ButDan But

5981 gold badge5 silver badges11 bronze badges

The SMTP server does not allow your computer to send emails.

You need to white list you computer in the SMTP server for sending emails

answered Jan 26, 2021 at 11:54

Nir's user avatar

NirNir

1,73820 silver badges24 bronze badges

  • Remove From My Forums
  • Question

  • Hello,

    I’m trying to do a very simple thing. I need to send an email from within my Exchange 2007 Transport Agent.

    I created a very simple app to test the mail sending. I use code similar to what you see below:

    Code Snippet

       Private Sub SendMessage()
            Dim MailMessage As New Mail.MailMessage(«<myaddress>@<server>», «recipients», «subject», «body»)
            Dim SmtpClient As New Mail.SmtpClient(«<server>»)
            SmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
            SmtpClient.Credentials = New NetworkCredential(«<myaddress>», «<mypassword>»)
            Try
                SmtpClient.Send(MailMessage)
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub

    For SMTP I use my Exchange 2007 server installed on the very same computer.

    If I type the same settings (server address, port, username, password, recipients, etc) into my mail client (Thunderbird) I can receive and send mails fine. However, if I type them in the code above, it will not work, always giving me this:

    «Syntax error, command unrecognized. The server response was: 5.7.3 Authentication unsuccessful»

    If I type incorrect username or password, the message changes to:

    «The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated»

    So I’m pretty sure the credentials are fine, and the problem is elsewhere.

    I searched the net and found many other people have the same problem, but nobody has a solution.

    With Exchange 2003 I used CDO and .NET 1.1, so I can’t comment if it is working with older versions of Exchange.

    Any ideas?

    Thanks in advance.

Answers

  • That issue is due to incompatibility of .NET 2.0 System.Net.Mail GSSAPI implementation and the Exchange 2007 one.

    After failing it also does not fall back to try a NTLM authentication, nor you can manually force a NTLM authentication.

    You can use the System.Web.Mail namespace of the 2.0 Framework and use NTLM Authentication.

    I’ve stumbled upon that issue in the past, here is the reply from Microsoft.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1858357&SiteID=1

    Best regards,

    Fernando Nunes

Содержание

  1. Syntax error command unrecognized the server response was
  2. Question
  3. Syntax error command unrecognized the server response was
  4. Question
  5. Syntax error command unrecognized the server response was
  6. Answered by:
  7. Question
  8. Answers
  9. All replies
  10. Syntax error command unrecognized the server response was
  11. Вопрос
  12. Syntax error command unrecognized the server response was
  13. Question

Syntax error command unrecognized the server response was

Question

I’m trying to do a very simple thing. I need to send an email from within my Exchange 2007 Transport Agent.

I created a very simple app to test the mail sending. I use code similar to what you see below:

Private Sub SendMessage()
Dim MailMessage As New Mail.MailMessage(» @ «, «recipients», «subject», «body»)
Dim SmtpClient As New Mail.SmtpClient(» «)
SmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
SmtpClient.Credentials = New NetworkCredential(» «, » «)
Try
SmtpClient.Send(MailMessage)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

For SMTP I use my Exchange 2007 server installed on the very same computer.

If I type the same settings (server address, port, username, password, recipients, etc) into my mail client (Thunderbird) I can receive and send mails fine. However, if I type them in the code above, it will not work, always giving me this:

«Syntax error, command unrecognized. The server response was: 5.7.3 Authentication unsuccessful»

If I type incorrect username or password, the message changes to:

«The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated»

So I’m pretty sure the credentials are fine, and the problem is elsewhere.

I searched the net and found many other people have the same problem, but nobody has a solution.

With Exchange 2003 I used CDO and .NET 1.1, so I can’t comment if it is working with older versions of Exchange.

Источник

Syntax error command unrecognized the server response was

Question

I’m trying to do a very simple thing. I need to send an email from within my Exchange 2007 Transport Agent.

I created a very simple app to test the mail sending. I use code similar to what you see below:

Private Sub SendMessage()
Dim MailMessage As New Mail.MailMessage(» @ «, «recipients», «subject», «body»)
Dim SmtpClient As New Mail.SmtpClient(» «)
SmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
SmtpClient.Credentials = New NetworkCredential(» «, » «)
Try
SmtpClient.Send(MailMessage)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

For SMTP I use my Exchange 2007 server installed on the very same computer.

If I type the same settings (server address, port, username, password, recipients, etc) into my mail client (Thunderbird) I can receive and send mails fine. However, if I type them in the code above, it will not work, always giving me this:

«Syntax error, command unrecognized. The server response was: 5.7.3 Authentication unsuccessful»

If I type incorrect username or password, the message changes to:

«The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated»

So I’m pretty sure the credentials are fine, and the problem is elsewhere.

I searched the net and found many other people have the same problem, but nobody has a solution.

With Exchange 2003 I used CDO and .NET 1.1, so I can’t comment if it is working with older versions of Exchange.

Источник

Syntax error command unrecognized the server response was

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

My exchange environment consist with «Server Exchange 2010 SP3» and «Edge Server with Exchange 2010 SP3».

On Edge server in SMTP receive log i get every now and then an entry: xxxxxx 500 5.3.3 Unrecognized command.

It is serius problem because I got few e-mails from senders that they had problem with sending e-mail messages to our e-mail domain. They receive e-mail report, for example

Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain domena.pl by mail.domena.pl . [95.xxx.xxx.xx ].

The error that the other server returned was:
500 5.3.3 Unrecognized command

Could you help me to solve this problem? What could cause this problem?

Thank you in advance

Kind Regards Tomasz

Answers

Error 5.3.3 indicates that server is out of disk space to accept incoming emails. Please check your disk space and the «Allowed limit» for mailboxes and the quota for them.

What’s more, please make sure that the necessary mail flow ports are opened if you have setup the firewall. Also, please ensure that DNS MX record is right. For your convenience:

Note: Microsoft is providing this thread as a convenience to you. The site is not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before using it.

Hope my clarification is helpful.

Amy Wang
TechNet Community Support

Error 5.3.3 indicates that server is out of disk space to accept incoming emails. Please check your disk space and the «Allowed limit» for mailboxes and the quota for them.

What’s more, please make sure that the necessary mail flow ports are opened if you have setup the firewall. Also, please ensure that DNS MX record is right. For your convenience:

Note: Microsoft is providing this thread as a convenience to you. The site is not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before using it.

Hope my clarification is helpful.

Amy Wang
TechNet Community Support

I have the same issue, but there is plenty of hard disk storage on the Exchange Server. This seems to only be happening from Google Business account/ Postini. If I send message from my personal Gmail account it works fine, but an agency who is on Google business seems to have issues sending to us and they are delayed, sometimes they get through and other times they just don’t.

Results from Mail Acceptance Test:

I enter my internal address and the remote users postini account as the test setup I received two emails from the tool but the end results of the test are:

Error submitting mail
Mail submission failed: Error message: Syntax error, command unrecognized. The server response was: 5.3.3 Unrecognized command.

Google support stated this:

Here are the logs from Postini trying to connect to mydomain.com (IP x.x.x.x) :

1. 2014/08/09 03:26:28 IP:209.85.218.50 SMTP-STLS:OK TLSv1:RC4-SHA Validate:None 2. 2014/08/09 03:26:28 IP:209.85.218.50 SMTP LOG: Sender => FFD:MAIL FROM:

Источник

Syntax error command unrecognized the server response was

Вопрос

I’m trying to do a very simple thing. I need to send an email from within my Exchange 2007 Transport Agent.

I created a very simple app to test the mail sending. I use code similar to what you see below:

Private Sub SendMessage()
Dim MailMessage As New Mail.MailMessage(» @ «, «recipients», «subject», «body»)
Dim SmtpClient As New Mail.SmtpClient(» «)
SmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
SmtpClient.Credentials = New NetworkCredential(» «, » «)
Try
SmtpClient.Send(MailMessage)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

For SMTP I use my Exchange 2007 server installed on the very same computer.

If I type the same settings (server address, port, username, password, recipients, etc) into my mail client (Thunderbird) I can receive and send mails fine. However, if I type them in the code above, it will not work, always giving me this:

«Syntax error, command unrecognized. The server response was: 5.7.3 Authentication unsuccessful»

If I type incorrect username or password, the message changes to:

«The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated»

So I’m pretty sure the credentials are fine, and the problem is elsewhere.

I searched the net and found many other people have the same problem, but nobody has a solution.

With Exchange 2003 I used CDO and .NET 1.1, so I can’t comment if it is working with older versions of Exchange.

Источник

Syntax error command unrecognized the server response was

Question

I’m trying to do a very simple thing. I need to send an email from within my Exchange 2007 Transport Agent.

I created a very simple app to test the mail sending. I use code similar to what you see below:

Private Sub SendMessage()
Dim MailMessage As New Mail.MailMessage(» @ «, «recipients», «subject», «body»)
Dim SmtpClient As New Mail.SmtpClient(» «)
SmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
SmtpClient.Credentials = New NetworkCredential(» «, » «)
Try
SmtpClient.Send(MailMessage)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

For SMTP I use my Exchange 2007 server installed on the very same computer.

If I type the same settings (server address, port, username, password, recipients, etc) into my mail client (Thunderbird) I can receive and send mails fine. However, if I type them in the code above, it will not work, always giving me this:

«Syntax error, command unrecognized. The server response was: 5.7.3 Authentication unsuccessful»

If I type incorrect username or password, the message changes to:

«The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated»

So I’m pretty sure the credentials are fine, and the problem is elsewhere.

I searched the net and found many other people have the same problem, but nobody has a solution.

With Exchange 2003 I used CDO and .NET 1.1, so I can’t comment if it is working with older versions of Exchange.

Источник

When I try to use SmtpEmailSender to send an e-mail with html body, then i got an error

[Error] Syntax error, command unrecognized. The server response was: 
System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: 
   at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
   at System.Net.Mail.SmtpTransport.EndGetConnection(IAsyncResult result)
   at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)

So I have to replace ISmtpEmailSender with my own sender

     context.Services.Replace(
                ServiceDescriptor.Transient<ISmtpEmailSender, MySmtpEmailSender>());
    public class MySmtpEmailSender:SmtpEmailSender
    {

        public MySmtpEmailSender(ISmtpEmailSenderConfiguration smtpConfiguration, IBackgroundJobManager backgroundJobManager) : base(smtpConfiguration, backgroundJobManager)
        {
        }

        protected override async Task SendEmailAsync(MailMessage mail)
        {
            AlternateView textView;
            AlternateView htmlView;
            mail = Fix(mail, out textView, out htmlView);
            try
            {
                using (var smtpClient = await BuildClientAsync())
                {
                    await smtpClient.SendMailAsync(mail);
                }
            }
            catch (Exception e)
            {
                throw;
            }
            finally
            {
                textView?.Dispose();
                htmlView?.Dispose();
                mail.Dispose();
            }

        }

        protected override void SendEmail(MailMessage mail)
        {
            AsyncHelper.RunSync(() => SendEmailAsync(mail));
        }


        protected MailMessage Fix(MailMessage message, out AlternateView textView, out AlternateView htmlView)
        {
            htmlView = null;
            textView = null;
            //force set encoding to utf8
            message.BodyEncoding=Encoding.UTF8;
            if (message.IsBodyHtml)
            {
                var mimeType = new ContentType("text/html");
                htmlView = AlternateView.CreateAlternateViewFromString(message.Body, mimeType);
                message.AlternateViews.Add(htmlView);
            }
            else
            {
                const string mediaType = "text/plain";
                textView = AlternateView.CreateAlternateViewFromString(message.Body, message.BodyEncoding, mediaType);
                textView.TransferEncoding = TransferEncoding.SevenBit;
                message.AlternateViews.Add(textView);
            }
            return message;


        }

So this works for me.

And I notice that MailMessage BodyEncoding will be automatically set after Body set, so part of codes in
EmailSenderBase.cs will never run

  1. I used this code:

    //create the mail message
    MailMessage mail = new MailMessage();

    //set the addresses
    mail.From = new MailAddress(«postmaster@fishabaka.com»);
    mail.To.Add(«mye-mail@live.com»);

    //set the content
    mail.Subject = «This is an email»;
    mail.Body = «this is a sample body with html in it. <b>test e-mail </b>»;
    mail.IsBodyHtml = true;

    //send the message
    SmtpClient smtp = new SmtpClient(«96.31.35.13», 21);
    NetworkCredential Credentials = new NetworkCredential(«postmaster@fishabaka.com», «password»,»fishabaka.com»);
    smtp.Credentials = Credentials;
    smtp.Send(mail);

    and I insert these tags within web.config file:

    <system.net>
    <mailSettings>
    <smtp deliveryMethod=»Network»>
    <network host =»96.31.35.13″ port =»21″ defaultCredentials=»true»/>
    </smtp>
    </mailSettings>
    </system.net>

    but I get this error:

    Syntax error, command unrecognized. The server response was: ‘HELO W01’: command not understood.

  2. Change these lines on your code…

    SmtpClient smtp = new SmtpClient(«96.31.35.13», 21);
    to
    SmtpClient smtp = new SmtpClient(«96.31.35.13»);

    and..

    <network host =»96.31.35.13″ port =»21″ defaultCredentials=»true»/>
    to
    <network host =»96.31.35.13″ port =»25″ defaultCredentials=»true»/>

    Port 21 is a FTP port it is not a SMTP port.

  3. I did as you said, but i get this error:

    No connection could be made because the target machine actively refused it 96.31.35.13:25

  4. Sorry I just realized the IP address you are using is the web servers IP address. The email server will have a different IP address. Try using this as the smtp server ‘mail.fishabaka.com’. This will point you to our email server.

  5. I got a new error:

    Mailbox unavailable. The server response was: <my-email@live.com> No such user here

    [SmtpFailedRecipientException: Mailbox unavailable. The server response was: <postmaster@fishabaka.comm> No such user here]
    System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +1078355
    System.Net.Mail.SmtpClient.Send(MailMessage message) +1480
    _Default.Button1_Click(Object sender, EventArgs e) in e:webfishabakDefault.aspx.cs:34
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

    should I change any settings of my e-mail from control panel?

  6. Mailbox unavailable. The server response was: <my-emailr@live.comm> No such user here

    This error means that the email address my-emailr@live.comm does not exist. I tried to ping ‘live.comm’ and the ping test failed so it proves that ‘live.comm’ doesn’t exist. I’m not sure if it is ‘live.com’ or something else but the error is pretty straight forward. This email ‘my-emailr@live.comm’ does not exist. Type in another email address and make sure it is a valide and active email address.

  7. dude.. you are trying to send to live.comm with an extra m.

  8. it’s just typing error while typing the replying …..

    but the syntax is well at my code ……

  9. Was this error type wrong also?

    —SmtpFailedRecipientException: Mailbox unavailable. The server response was: <postmaster@fishabaka.comm> No such user here—

    Regardless, the email address you are typing on the code is wrong or the email address does not exist. I suggest double checking them.

  10. O.K … I can now send e-mail to postmaster@fishabaka.com

    but I can’t to external e-mails

    I always get this error:

    Mailbox unavailable. The server response was: <anymail@hotmail.com> No such user here

  11. Are you sure that this email address is active ‘anymail@hotmail.com’?

    If the email address are active, then the most likely cause is that you are not passing the SMTP authentication correctly. Remember, our SMTP server requires that you log in first before it will send out the email.

  12. hi Ray …..

    What do you mean by SMTP authentication? if you mean username & password ,both of them are right.

    should I make any configuration of my mail server???

  13. SMTP authentication is just another phrase which means you need to pass a login and password to the email server before the email server will send out the email. The login and password for the smtp server will not be the account or site ID login, but the full email address that exist in our smtp server. Typically you should have a postmaster account that will have an email address similar to this ‘postmaster@[somethingdomain].com’. I will not know the password that is something you will need to find out for yourself.
    Some programmers choose to declare these values and pass it off as variables. I suggest that you do not declare them but hard code them in.
    How do you know if your email account is working?
    The best way to know is to setup an email client such as Outlook to connect to the POP3 and SMTP server and set it up for SMTP authentication. If you email client can send it out then the SMTP server is working and it should work for your web site. But if it is not working for your website then you’ll know its because of some programming mistake somewhere in the coding.

  14. I did it !!!!!!!!

    I just removed the parameter of string domain (fishabaka.com) .. and I can now send e-mails to any e-mail !!!

    Than kyou very much Ray

  15. I believe you are speaking of this line..

    NetworkCredential Credentials = new NetworkCredential(«postmaster@fishabaka.com», «password»,»fishabaka.com»);

    Sorry I should have caught that.

Share This Page


Winhost Community Forum

Понравилась статья? Поделить с друзьями:
  • Syntax error cannot use import statement outside a module nodejs
  • Syntax error cannot use import statement outside a module jest
  • Syntax error cannot assign to literal
  • Syntax error cannot assign to function call
  • Syntax error cannot assign to conditional expression