EDN Admin
Well-known member
Please help me on this issue. Until this morning my SendMail process was working fine and I was able to send Email to internal and External contacts using this code. However, all of sudden it stopped working and giving below error
"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated"
I am using our corporate Exchange Server 2010 and my port number is
<span style="font-size:x-small 587
My Code
public static void SendMailMessage(string Hostname, int Portno, string @from, string recepient, string bcc, string cc, string subject, string body)<br/>
{<br/>
try<br/>
{<br/>
// Instantiate a new instance of MailMessage<br/>
MailMessage EmailMessage = new MailMessage();<br/>
EmailMessage.From = new MailAddress(@from);<br/>
<br/>
EmailMessage.To.Add(new MailAddress(recepient));
EmailMessage.Subject = subject;
<br/>
EmailMessage.Body = body;<br/>
<br/>
EmailMessage.IsBodyHtml = true;
<br/>
EmailMessage.Priority = MailPriority.Normal;<br/>
<br/>
SmtpClient MyClient = new SmtpClient();<br/>
MyClient.Host = Hostname;
<br/>
MyClient.Port = Portno;
MyClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;<br/>
<br/>
// Send the mail message<br/>
MyClient.Send(EmailMessage);<br/>
}<br/>
catch (Exception e)<br/>
{<br/>
String S = e.Message.ToString();<br/>
}<br/>
}
I cant figure it out why all of sudden it stopped working as I did not change any code and any setup in the Exchange server. Please help me on this
Thanks,
Raj
<hr class="sig Dreaming a world without any war in anywhere
View the full article
"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated"
I am using our corporate Exchange Server 2010 and my port number is
<span style="font-size:x-small 587
My Code
public static void SendMailMessage(string Hostname, int Portno, string @from, string recepient, string bcc, string cc, string subject, string body)<br/>
{<br/>
try<br/>
{<br/>
// Instantiate a new instance of MailMessage<br/>
MailMessage EmailMessage = new MailMessage();<br/>
EmailMessage.From = new MailAddress(@from);<br/>
<br/>
EmailMessage.To.Add(new MailAddress(recepient));
EmailMessage.Subject = subject;
<br/>
EmailMessage.Body = body;<br/>
<br/>
EmailMessage.IsBodyHtml = true;
<br/>
EmailMessage.Priority = MailPriority.Normal;<br/>
<br/>
SmtpClient MyClient = new SmtpClient();<br/>
MyClient.Host = Hostname;
<br/>
MyClient.Port = Portno;
MyClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;<br/>
<br/>
// Send the mail message<br/>
MyClient.Send(EmailMessage);<br/>
}<br/>
catch (Exception e)<br/>
{<br/>
String S = e.Message.ToString();<br/>
}<br/>
}
I cant figure it out why all of sudden it stopped working as I did not change any code and any setup in the Exchange server. Please help me on this
Thanks,
Raj
<hr class="sig Dreaming a world without any war in anywhere
View the full article