MailMessage mailMessage = new MailMessage();
mailMessage.To.Add(”test@test.com”);
mailMessage.Subject = “Test”;
mailMessage.Body = “This is a test mail”;
mailMessage.IsBodyHtml = true;
// Create the credentials to login to the gmail account associated with my custom domain
string sendEmailsFrom = “abc@xyz.com”;
string sendEmailsFromPassword = “password”;
NetworkCredential cred = new NetworkCredential(sendEmailsFrom, sendEmailsFromPassword);
SmtpClient mailClient = new SmtpClient(”smtp.gmail.com”, 587);
mailClient.EnableSsl = true;
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mailClient.UseDefaultCredentials = false;
mailClient.Timeout = 30000;
mailClient.Credentials = cred;
mailClient.Send(mailMessage);
ThanksAnil Kumar PandeySystem ArchitectGreen Point Technology (India) Ltd.Mumbai, MaharshtraINDIA
i am trying to send a mail through gmail host.i am getting following error.
ReplyDelete(The remote name could not be resolved: smtp.gmail.com)
please send me answer to santosh.mca08@gmail.com