Hello,
Example is simple, shown on many forums, but not working.
On last line I obtain exception: "Failure sending mail".
Anyway, Is it possible to send mail from my workstation (localhost)?
If yes, then next problem occur - Mail.From Address. Shoud I provide sender address when I send from localhost?
I tried examples from many sources. Unfortunatelly, results the same..
Thank You for Your help.
Paul
Example is simple, shown on many forums, but not working.
Code:
MailMessage mail = new MailMessage();
mail.To.Add("add1@gmail.com");
mail.From = new MailAddress("add2@gmail.com");
mail.Subject = "Test Email";
mail.Body = "Hello";
SmtpClient smtp = new SmtpClient();
smtp.Host = "localhost";
smtp.Send(mail);
Anyway, Is it possible to send mail from my workstation (localhost)?
If yes, then next problem occur - Mail.From Address. Shoud I provide sender address when I send from localhost?
I tried examples from many sources. Unfortunatelly, results the same..
Thank You for Your help.
Paul
Comment