Morcos Adel

Morcos Adel

  • NA
  • 195
  • 49.4k

Sending e-mail problem

Dec 29 2008 12:11 PM
Hi i am developing an application that sends e-mails without opening an internet explorer and i tried the following code:

System.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?????

Answers (2)