Can MailClient.Send use HELO

On our web server we are trying to use MailClient.Sent to send a mail through our mail server, but our mail server doesn't support EHLO. Can MailClient.Send be configured to use HELO rather than EHLO and if so, how
Some quick pre-emptive answers, A1) No, getting rid of the McAfee Webshield SMTP that doesn't support EHLO is not an option. A2) Talking direct to the mail server on a diferent port than 25 to bypass the Webshield software is not an option.

Thanks in advance for any help.

Regards
Cameron


Answer this question

Can MailClient.Send use HELO

  • gruflee

    Durgaprasad Gorti wrote:

    If the server does not support EHLO, we should be trying HELO
    Are you saying that we don't do that



    Here's the error page

    Command not implemented. The server response was: Command not Supported

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Net.Mail.SmtpException: Command not implemented. The server response was: Command not Supported

    Source Error:

    Line 10: 
    Line 11: SmtpClient mailClient = new SmtpClient(txtServer.Text);
    Line 12: mailClient.Send(msgMail);
    Line 13: }
    Line 14: </script>

    Source File: d:\Subscriptions\test.aspx Line: 12

    Stack Trace:

    [SmtpException: Command not implemented. The server response was: Command not Supported]
    System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +922
    System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +316
    System.Net.Mail.SmtpClient.GetConnection() +42
    System.Net.Mail.SmtpClient.Send(MailMessage message) +2004
    ASP.test_aspx.btnSend_Click(Object sender, EventArgs e) in d:\Subscriptions\test.aspx:12
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

  • gpetrosh

    If the server does not support EHLO, we should be trying HELO
    Are you saying that we don't do that



  • Ravi Varma

    Helo!
    Did a little testing... I cannot find a way to force SmtpClient to use HELO. Yet I found out that if the server responds with 500 (Command not recognized) to EHLO, SmtpClient will try again with HELO. It will not if it gets any other of the errors I tried.

    Now, the "Command not Supported" in your stack trace looks like a 502 (Command not implemented), which wouldn't be a legal response to EHLO or HELO under either RFC821 or RFC2821. If you can confirm that the server is indeed sending back a 502, then unfortunately it's the server's fault and I don't think there is anything you can do.

    Just for the record, SmtpClient behaviour is "legally" correct... RFC2821 (3.2) states that the client should fall back to HELO if it gets a "Command not recognized" (i.e. 500) to its EHLO. No other options are given. And 502 in response to EHLO is just plain wrong, regardless of what RFC it was written against. Yet, it's sad that SmtpClient isn't flexible enough to re-try with a HELO anyway... not going to choke the network, I presume.

    Sorry for the bad news... unless McAfee provides a patch I'm afraid you will have to roll out your own smtp client library, or download one. Or I could just be wrong ;)

    HTH
    --mc


  • Can MailClient.Send use HELO