tags:

views:

21

answers:

0

Sending Email using MD5 Challenge-Reponse Authentication

hello, Im trying to send email using MD5 Challenge Response, but it is not working with me, heres the code i am trying:

        System.Net.Mail.MailMessage mMsg = new System.Net.Mail.MailMessage("[email protected]", "[email protected]", "test", "test");
        mMsg.IsBodyHtml = true;
        System.Net.Mail.SmtpClient smtpC = new System.Net.Mail.SmtpClient();   
        smtpC.Host = "mail.***.com";
        smtpC.Port = 465;
        smtpC.EnableSsl = true;
        smtpC.UseDefaultCredentials = false;
        System.Net.NetworkCredential creds = new System.Net.NetworkCredential("sales@***.com", "***", "***.com");
        smtpC.Credentials = creds.GetCredential("mail.***.com", 465, "CRAM-MD5"); ;
        smtpC.Send(mMsg);

This is the error Im getting: System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed. at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller) 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)