Hi i am developing an application that sends e-mails without opening an internet explorer and i tried the following code:
S
ystem.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add("[email protected]");
message.Subject = "Ava Kirolos";
message.From = new System.Net.Mail.MailAddress("[email protected]");
message.Body = "If God is for us";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("localhost");
try
{
smtp.Send(message);
}
catch (Exception caught)
{
MessageBox.Show("error");
}but it throws an exception : Failure sending mail
can any body plz help me with that issue?????