SMTPClient Problems

Just converted my vs.net 2003 project to 2005. Changed to system.net.mail. I get the following error when i get to the send command -
{"Command not implemented. The server response was: Command not Supported"}

Here's the code.


Dim ErrMail As New MailMessage(New MailAddress(cVariables.UserEmail), New MailAddress(MailTo))

With ErrMail

.Subject = subject

.Body = Message

End With

Dim MailClient As New SmtpClient(Our Email Server)

MailClient.Send(ErrMail)


 



Many thanks



Answer this question

SMTPClient Problems

  • advind

    Can you please send a network trace
    Or System.Net trace see for instructions
    http://blogs.msdn.com/dgorti/archive/2005/09/18/471003.aspx

  • drmcl

    We need to look at the SOCKET level trace.
    That gives us exactly what is happening on the wire.
    1. Please post a complete sample that gives this behavior
    2. Please Set the trace file with the socket trace
    3. The System.Data.Dll should not be here. Why is it throwing an exception
    4. Remove the code for System.Data.dll and, once again write a simple sample
    that gives you this behavior.
    5. Tell us what the server is  and what version of the framework you are using .



  • Lifeboy

    if it is working on some machines and not working on others
    then it is probably a machine issue.
    if it says command not implemented, then the server is not able to
    do what you are asking it to do.

    In any case please send a complete NETMON trace. Thats the only way
    we can troubleshoot.
    See http://blogs.msdn.com/dgorti for notes on how to use NETMON

  • ddynda

    Is this a new issue or connected to the existing issue
    if this is a new issue opena new thread

     



  • Shawn K.

    I can second this. Ran into the same problem when we switched to .NET v2

    We are using McAfee webshield as our SMTP gateway.

    Our workaround was to switch the port number to 8025 in the ASP code - Our MS SMTP connector listens on 8025 on the same box as McAfee.

    Works fine talking to the the MS SMTP : )


  • Varun Gupta

    Helo,

    I have error in smtpclient() with remote server. Application with local server not have error.

    Log:

    'NewsLetter.vshost.exe' (Managed): Loaded 'I:\NewsLetter\NewsLetter\bin\Debug\NewsLetter.exe', Symbols loaded.

    'NewsLetter.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

    System.Net Verbose: 0 : [2900] SmtpClient::.ctor(host=mail.cs.interbusiness.it)

    System.Net Information: 0 : [2900] Associating SmtpClient#843226 with SmtpTransport#37945174

    System.Net Verbose: 0 : [2900] Exiting SmtpClient::.ctor() -> SmtpClient#843226

    System.Net Verbose: 0 : [2900] SmtpClient#843226::Send(MailMessage#29811240)

    System.Net Information: 0 : [2900] SmtpClient#843226::Send(DeliveryMethod=Network)

    System.Net Information: 0 : [2900] Associating SmtpClient#843226 with MailMessage#29811240

    System.Net Information: 0 : [2900] Associating SmtpTransport#37945174 with SmtpConnection#66437409

    System.Net Information: 0 : [2900] Associating SmtpConnection#66437409 with ServicePoint#36893403

    System.Net.Sockets Verbose: 0 : [2900] Socket#49590434::Socket(InterNetwork#2)

    System.Net.Sockets Verbose: 0 : [2900] Exiting Socket#49590434::Socket()

    System.Net.Sockets Verbose: 0 : [2900] Socket#49590434::Connect(62:25#1041245516)

    System.Net.Sockets Verbose: 0 : [2900] Exiting Socket#49590434::Connect()

    System.Net Information: 0 : [2900] Associating SmtpConnection#66437409 with SmtpPooledStream#16977025

    System.Net.Sockets Verbose: 0 : [2900] Socket#49590434::Receive()

    System.Net.Sockets Verbose: 0 : [2900] Data from Socket#49590434::Receive

    System.Net.Sockets Verbose: 0 : [2900] 00000000 : 35 35 34 20 69 62 73 30-33 2E 69 6E 74 65 72 62 : 554 ibs03.interb

    System.Net.Sockets Verbose: 0 : [2900] 00000010 : 75 73 69 6E 65 73 73 2E-69 74 0D 0A : usiness.it..

    System.Net.Sockets Verbose: 0 : [2900] Exiting Socket#49590434::Receive() -> 28#28

    System.Net Error: 0 : [2900] Exception in the SmtpClient#843226::Send - Transaction failed. The server response was: ibs03.interbusiness.it

    System.Net Error: 0 : [2900] at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)

    at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)

    at System.Net.Mail.SmtpClient.GetConnection()

    at System.Net.Mail.SmtpClient.Send(MailMessage message)

    System.Net.Sockets Verbose: 0 : [2900] Socket#49590434::Dispose()

    A first chance exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

    System.Net Verbose: 0 : [2900] Exiting SmtpClient#843226::Send()

    The thread 0x860 has exited with code 0 (0x0).

    The thread 0xb54 has exited with code 0 (0x0).

    The program '[1540] NewsLetter.vshost.exe: Managed' has exited with code 0 (0x0).

    help me. Thanks


  • Shijun

    If this is a new issue, create a new thread
    Use the netmon capture to tell you really what is going on,
    the smtp server may be an older server that is not behaving properly



  • Harry Strand

    Apparently the server I was using is using a Mcafee SMTP server built into one of their products. Switched to another SMTP Server and works fine now.
  • Alok.Ganguly

    I have the same problem. I did a packet trace and found that the SMTP relay I was trying to send through did not support ehlo. It supports HELO, but EHLO seems to be the default method for ASP.NET 2.0 (possibly others, I'm not sure) If anyone knows of a way to change that default behaviour I would greatly appreciate it. Thanks!


  • adange

    I have the same problem described here: 

    Command not implemented.

    Why if use smtp server "mail.cs.interbusiness.it" I have this error   If IIS use smtpclient() all works.  Thanks

    Insert C#  application code:

    private void button1_Click(object sender, EventArgs t)

    {

    string strMailTo = textBox2.Text.Trim();

    string strMailToName = textBox3.Text.Trim();

    string strSoggetto = textBox5.Text.Trim();

    string strServer = textBox1.Text.Trim();

    FileStream fs = null;

    try

    {

    FileStream fsB = new FileStream(NameFileBody, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

    StreamReader srB = new StreamReader(fsB);

    string strResultBody = srB.ReadToEnd();

    srB.Close();

    fsB.Close();

     

    fs = new FileStream(NameFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

    StreamReader sr = new StreamReader(fs);

    string strResult = sr.ReadToEnd();

    sr.Close();

    fs.Close();

    string[] strMailAdress = strResult.Split(Convert.ToChar("\n"));

    for (int i = 0; i < (strMailAdress.Length - 1); i++)

    {

    string stradressto = strMailAdress[ i ].Trim();

    MailAddress from = new MailAddress(strMailTo, strMailToName);

    MailAddress to = new MailAddress(stradressto);

    MailMessage message = new MailMessage(from, to);

    message.Subject = strSoggetto;

    message.Body = strResultBody;

    SmtpClient client = new SmtpClient(strServer);

    // Include credentials if the server requires them.

    client.Credentials = CredentialCache.DefaultNetworkCredentials;

    client.Send(message);

    }

    MessageBox.Show("Newsletter Inviata Correttamente", "Messsaggio di Informazione", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

    }

    catch (Exception e)

    {

    MessageBox.Show("Attenzione Errore!! \n" + e.Message + "\n" + e.StackTrace + "\n" + e.Data, "Messsaggio di errore", MessageBoxButtons.OK, MessageBoxIcon.Error);

    }

    {

    if (fs != null) fs.Close();

    }

    }

     


  • SeveQ

    I think this is what you want. The first line is where an error occurs to fire off an email to the support desk. At the bottom you can see where the error occurs with the smtpclient. Thanks.


    A first chance exception of type 'System.IndexOutOfRangeException' occurred in System.Data.dll

    System.Net Information: 0 : Associating Message#4861097 with HeaderCollection#43749873

    System.Net Information: 0 : HeaderCollection#43749873::Set(mime-version=1.0)

    System.Net Information: 0 : SmtpClient::.ctor(host=GATE.TORBAY)

    System.Net Information: 0 : Associating SmtpClient#58204539 with SmtpTransport#54078809

    System.Net Information: 0 : Exiting SmtpClient::.ctor() -> SmtpClient#58204539

    System.Net Information: 0 : SmtpClient#58204539::Send(MailMessage#16947234)

    System.Net Information: 0 : SmtpClient#58204539::Send(DeliveryMethod=Network)

    System.Net Information: 0 : Associating SmtpClient#58204539 with MailMessage#16947234

    System.Net Information: 0 : Associating SmtpTransport#54078809 with SmtpConnection#18307385

    System.Net Information: 0 : Associating SmtpConnection#18307385 with ServicePoint#30548742

    System.Net Information: 0 : Associating SmtpConnection#18307385 with SmtpPooledStream#6503226

    System.Net Error: 0 : Exception in the SmtpClient#58204539::Send - Command not implemented. The server response was: Command not Supported

    System.Net Error: 0 : at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)

    at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)

    at System.Net.Mail.SmtpClient.GetConnection()

    at System.Net.Mail.SmtpClient.Send(MailMessage message)

    A first chance exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

    System.Net Information: 0 : Exiting SmtpClient#58204539::Send()


     


  • PaulOfTheGlen

    Hi,

    We have exactly the same problem. The same code (using the SmtpClient) was used on 3 different Windows System. It worked fine on XP Pro but failed on Windows Server 2000 and Windows Server 2003. The error is "Command not implemented".

    Hope it helps,
    Regards

  • SMTPClient Problems