i have some code below
try {
SmtpClient SmtpServer = new SmtpClient();
string sBody = null;
sBody = "body content";
var _with1 = SmtpServer;
_with1.Credentials = new System.Net.NetworkCredential("abc@gmail.com", "abc");
_with1.Host = "smtp.gmail.com";
_with1.EnableSsl = true;
using (MailMessage mail = new MailMessage()) {
//mail = New MailMessage()
var _with2 = mail;
_with2.From = new MailAddress("abc@gmail.com");
_with2.To.Add("cdf@yahoo.com.vn");
_with2.Subject = "Thông báo có góp ý cho câu hỏi";
_with2.Body = sBody;
_with2.IsBodyHtml = true;
SmtpServer.Send(mail);
}
} catch (Exception) {
throw;
}
it works fine at window 7
But when i run it on window server 2003, it have an error: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at"
Please help me fix it!
thanks