Ankit Kumar

Ankit Kumar

  • NA
  • 61
  • 5.7k

mail not firing from windows application tool

Sep 5 2017 9:49 AM
Email not firing from windows application tool from a particular network but from other networks its working file i placed my code below.
 
private void button1_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
try
{
MailMessage m = new MailMessage();
sb = new StringBuilder();
m.From = new MailAddress("[email protected]");
m.To.Add(new MailAddress("[email protected]"));
string SUBJECT = string.Empty;
SUBJECT = "TestMail";
sb.Append("Hi Its a test mail <b/><br/><br/>");
m.Subject = SUBJECT;
m.Body = sb.ToString();
m.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.verbinden.in";
smtp.Port = 587;
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Timeout = 80000;
smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "Noreply123$");
smtp.Send(m);
MessageBox.Show("Email has been send");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
 

Answers (1)