Here is the small piece of code to send emails through Dotnet Applications
Sometimes, you may face the below error while sending the email from your app.
"The remote name could not be resolved: 'smtp.gmail.com'"
Fix for this issue: "The remote name could not be resolved: 'smtp.gmail.com'"
1. Check ur Internet connection - This could be the main problem
2. Ur email is blocked for some reason.
3. Ur domain administrator or ur domain is blocked.
Cheers,
Venkatesan Prabu .J
http://www.facebook.com/KaaShivInfoTech
MailMessage mail = new MailMessage(); mail.To.Add(To Addressd"); mail.From = new MailAddress("GmailID@gmail.com"); mail.Subject = "Subject of your email"; string Body = "Hi, this mail is to test sending mail" mail.Body = Body;
SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.UseDefaultCredentials = False; mail.IsBodyHtml = true; smtp.Credentials = new System.Net.NetworkCredential ("GmailID@gmail.com","Ur Gmail or email password"); smtp.EnableSsl = true; smtp.Send(mail);
"The remote name could not be resolved: 'smtp.gmail.com'"
Fix for this issue: "The remote name could not be resolved: 'smtp.gmail.com'"
1. Check ur Internet connection - This could be the main problem
2. Ur email is blocked for some reason.
3. Ur domain administrator or ur domain is blocked.
Cheers,
Venkatesan Prabu .J
http://www.facebook.com/KaaShivInfoTech