Dear Friends,
Yesterday i had sent a mail using smtp.aol.com as host succesfully.but it was gone to spam mail to my friends mail id.
the coding i used is
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
MailAddress fromAddress = new MailAddress("sanjithbtech@aol.com", "sanjith");
message.From = fromAddress;
message.To.Add("tamilselvank@i3itpeople.com");
message.Subject = "Feedback";
message.CC.Add("cc@site.com");
message.Bcc.Add(new MailAddress("bcc@site.com"));
message.IsBodyHtml = false;
message.Body = @"Plain or HTML Text";
smtpClient.Send(message);
}
catch (Exception ex)
{
}
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient();
System.Net.NetworkCredential basicCrenntial =
new System.Net.NetworkCredential("sanjithbtech@aol.com", "bmbitsba");
mailClient.Host = "smtp.aol.com";
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = basicCrenntial;
mailClient.Send(message);
lblStatus.Text = " Send Successfully!";
but when i sending through the same coding in the morning,it was showing the following error as
Server Error in '/' Application.
The remote certificate is invalid according to the validation procedure.
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.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
Source Error:
Line 154: objSmtpClient.Credentials = new System.Net.NetworkCredential("sanjithbtech@aol.com", "bmbitsba");
Line 155:
Line 156: objSmtpClient.Send(objEmail);
Line 157:
Line 158:
Source File: c:\inetpub\vhosts\cegonsoftfaq.com\httpdocs\ContactUs.aspx.cs Line: 156
Stack Trace:
[AuthenticationException: The remote certificate is invalid according to the validation procedure.]
System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception) +1646387
System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) +6153133
System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +137
System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) +53
System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) +120
System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +85
System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) +61
System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) +137
System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) +53
System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) +120
System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) +85
System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest) +61
Whats the problem with this coding.what port i have to use.or any other solution.