I am sending an email with some attachments and some basic information. So every thing is sending perfectly. But when ever i check my inbox mail not yet there, So i tried closing my application form. So that time mail came.
So tired a lot of time and i found that when ever i send the mail and closing my entire form that time email is received in the recipient mailbox. Any ideas!!!
code snippet:
SmtpClient smtp = new SmtpClient(smtpserver, 25);
MailMessage msg = new MailMessage();
msg.From = new MailAddress(email_From);
msg.To.Add(email_Recipient);
msg.IsBodyHtml = true;
msg.Subject = email_Subject;
///Attachment's and Body
try
{
_f3.ShowDialog();
smtp.Send(msg);
MessageBox.Show("Email Successfully Sent!!!", "Mail!!!.");
Environment.Exit(0);// -->> if i keep this mail is going.. else i have to close
// my application to receive mail
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}