Matiki Mahlangu

Matiki Mahlangu

  • NA
  • 42
  • 6.5k

Sending Email Using C#

Nov 3 2014 3:21 AM
Hi There
I'm trying to write a code that send email. Created a service, deployed in the server where i have configured the smtp settings.
When sending the email i'm getting the following error and also see the piece of code.
"The remote name could not be resolved. smtp.servername.edu.gov.za"

MailMessage mail = new MailMessage();

SmtpClient SmtpServer = new SmtpClient("smtp server");
mail.From =
new MailAddress("source");
mail.To.Add(
"destination");
mail.Subject =
"Testing";
mail.Body =
"Awe TestingL";
SmtpServer.Port = 25;
 
SmtpServer.EnableSsl =
true;

SmtpServer.Send(mail);
MessageBox.Show("mail Send");

May you please assist.

Answers (2)