Hi All,
I am having an send email functionality in c# application.
Following is the code I am using to send email -
public static bool SendMail(string toList, string from, string ccList, string subject, string body)
{
bool flag = false;
MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient();
string msg = string.Empty;
try
{
MailAddress fromAddress = new MailAddress(from);
message.From = fromAddress;
message.To.Add(toList);
if (ccList != null && ccList != string.Empty)
message.CC.Add(ccList);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
smtpClient.Host = "smtp.compName.org";
smtpClient.Port = 587;
smtpClient.EnableSsl = false;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = new System.Net.NetworkCredential(UserName,Password);
smtpClient.Send(message);
flag = true;
}
catch (Exception ex)
{
msg = ex.Message;
}
return flag;
}
I am using the same function from more than 8 months. Suddenly what happens I didn't understand.
I am not getting any emails from my applications. It has log entries - Mail sent successfully.
There is no any exception.
From above code I have commented
message.IsBodyHtml = true; this line and I am getting emails but its html code.
What is the problem I am not understanding!!!
I am using network solutions service to send email.
Please suggest , ASAP.
Thanks for your suggestions in advance.
Regards,
Avinash