StringBuilder emailMessage = new StringBuilder();
emailMessage.Append(\"Dear Payment Team ,\");
emailMessage.Append(\"
Please find the Payment ins
First, you don't need to manually read the values in your .config file. You can set the in the System.Net section and your SmtpClient object will read them automatically:
Then, from your code, you just write:
SmtpClient smtp = new SmtpClient();
MailMessage mailMessage = new MailMessage();
mailMessage.To.Add(new MailAddress("recipient@somedomain.com", "Recipient Display Name"));
mailMessage.Subject = "Some Subject";
mailMessage.Body = "One gorgeous body";
smtp.Send(mailMessage);
Coming back to your error, it would appear you have some kind of a network problem.