i get some problem when i try to send email notif with smtp using Gmail host
This is my code
DataTable dtEmail = objBLL.SubmitEmailPelaporan(userTest);
string content = dtEmail.Rows[0]["MsgDetail"].ToString();
string subject = dtEmail.Rows[0]["Subject"].ToString();
MailMessage mail = new MailMessage();
mail.IsBodyHtml = true;
mail.From = new MailAddress(emailSender);
mail.To.Add(new MailAddress(emailTo));
mail.Subject = subject;
mail.Body = content;
SmtpClient SmtpServer = new SmtpClient();
SmtpServer.Host = "smtp.gmail.com";
SmtpServer.Port = 587;
SmtpServer.UseDefaultCredentials = true;
SmtpServer.Credentials = new System.Net.NetworkCredential(emailSender, emailPassword);
//SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
My Error is "Failure to sending email" Inner Exception "Unable to connect the remote server"
i already to searhing too in google with my proble but i got the same error, failure sending email...unable to connect the remote server.
Thx All for helping me