Hi ,
Am developing a Windows application in which one module has to send a report to customers a mail.. the Question is
I use net.mail namespace in c# and here comes the code .
try
{
SmtpClient smtp = new SmtpClient();
MailMessage msg = new MailMessage();
smtp.Credentials = new System.Net.NetworkCredential("myusername", "password");
smtp.Port = 587;
//smtp.Port = 465;
smtp.Host = "smtp.gmail.com";
msg = new MailMessage();
msg.From = new MailAddress("fromtxtBox.text");
msg.To.Add("totxtBox.text");
msg.Subject = subtxtBox.text;
msg.Body = drafttxtBox.text
smtp.Send(msg);
label1.Text = "mail sent";
}
catch (Exception ec)
{
MessageBox.Show(ec.Message);
}
It works good in my previous task bt thn now i always get exception....why is that so....