hi
plese help me
i had developed a web application.. in my application i need to sent a mail to customer.. if i run my application in local system its the mail was sent successfully. but after hosting the application the mail was not sent
this is my code
SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 587;
System.Net.NetworkCredential credentials =
new System.Net.NetworkCredential("[email protected]", "suresh57");
client.UseDefaultCredentials = false;
client.Credentials = credentials;
MailMessage msg = new MailMessage();
msg.From = new MailAddress("[email protected]");
msg.To.Add(new MailAddress(to));
string BccAddress = "[email protected]";
msg.Bcc.Add(BccAddress);
msg.Subject = subject;
msg.Body = body;
try
{
client.Send(msg);
res = true;
}
catch (Exception ex)
{
}
Loading

Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 14, 2013, 11:32 AM EDT
your code looks correct. may be your mail going to spam or junk folder check that.
Also check by changing port no 587 to 25. it may help you.
Suthish NairRank #92 · 22.8K reputationPosted Sep 17, 2013, 12:20 AM EDT