I coded for mailing in the form but now presently its not working, so i asked with my colleague about it, he replied : we cant mail before deployment it wont work. so I want to confirm it ,is it right?
I tried with this below code.
Code
public void sendMail()Code
{Code
tryCode
{Code
MailMessage objeto_mail = new MailMessage();Code
SmtpClient client = new SmtpClient();Code
client.Port = 25;Code
client.Host = "smtp.internal.elifeindia.in";Code
client.Timeout = 10000;Code
client.DeliveryMethod = SmtpDeliveryMethod.Network;Code
client.UseDefaultCredentials = false;Code
client.Credentials = new System.Net.NetworkCredential("[email protected]", "9052251772");Code
objeto_mail.From = new MailAddress("[email protected]");Code
objeto_mail.To.Add(new MailAddress(txtEmailId.Text));Code
objeto_mail.Subject = "Password Recover";Code
objeto_mail.Body = "Message";Code
client.Send(objeto_mail); } catch (Exception ex) { Response.Write(ex.ToString());Code
}Code
}
Pradeep ShetRank #595 · 4K reputationPosted Apr 20, 2015, 11:27 PM EDT
He said that way because may be that smtp server is accessible from the deployment server only and not from your system.
Rahul BansalRank #143 · 15.9K reputationPosted Apr 20, 2015, 11:28 PM EDT
dawood abbas43 reputationPosted Apr 20, 2015, 11:38 PM EDT
there throwing an error : Failure sending mail.
dawood abbas43 reputationPosted Apr 20, 2015, 11:41 PM EDT
Manoj BhoirRank #599 · 4K reputationPosted Apr 20, 2015, 11:42 PM EDT
What about client.EnableSsl = ?
dawood abbas43 reputationPosted Apr 20, 2015, 11:58 PM EDT