2
Answers

Sending e-mail problem

Morcos Adel

Morcos Adel

15y
3k
1
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)