dawood abbas

dawood abbas

  • NA
  • 56
  • 4.8k

Could I mail before deployment the project?

Apr 21 2015 3:12 AM

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.

public void sendMail() 
{ 
try 
{ 
MailMessage objeto_mail = new MailMessage(); 
SmtpClient client = new SmtpClient();                 
client.Port = 25;                 
client.Host = "smtp.internal.elifeindia.in";                 
client.Timeout = 10000;                 
client.DeliveryMethod = SmtpDeliveryMethod.Network;                 
client.UseDefaultCredentials = false;                 
client.Credentials = new System.Net.NetworkCredential("[email protected]", "9052251772");                 
objeto_mail.From = new MailAddress("[email protected]");                
 objeto_mail.To.Add(new MailAddress(txtEmailId.Text));                 
objeto_mail.Subject = "Password Recover";                
 objeto_mail.Body = "Message";                 
client.Send(objeto_mail); } catch (Exception ex) { Response.Write(ex.ToString()); 
} 
}

Answers (6)