My application send emails to clients, but now user wants to know whether mail exists or not before sending it, or give notification that email bounced back.
How can i test whether the email inputted by User exists or not before sending mail using C# asp.net if not that then can we check if the mail has been bounced.
- I saw TELNET command but it was not working.
- I came across something ListNanny ( don't really know how to use it)
- I also found VRFY and RCPT ( didn't really looked much on that as of now)
please let me know if anyone has done similar kind of work in their project or POC. Meanwhile I am also looking for solutions.
We are using SMTP server for sending emails and our application is in ASP.NET application.
here is the sample of my code:
var host = ConfigurationManager.AppSettings[Constants.AppSettings.SMTP_HOST]; var emailFromAddress = ConfigurationManager.AppSettings[Constants.AppSettings.EMAIL_FROM_ADDRESS]; var emailFromName = ConfigurationManager.AppSettings[Constants.AppSettings.EMAIL_FROM_NAME]; using (var mail = new MailMessage()) { mail.Body = body; mail.IsBodyHtml = true; if (!String.IsNullOrEmpty(emailTo)) foreach (var email in emailTo.Split(Constants.Default.EMAILID_SEPARATOR)) mail.To.Add(new MailAddress(email)); if (!String.IsNullOrEmpty(emailCC)) foreach (var email in emailCC.Split(Constants.Default.EMAILID_SEPARATOR)) mail.CC.Add(new MailAddress(email)); mail.From = new MailAddress(emailFromAddress, emailFromName); mail.Subject = subject; mail.Priority = MailPriority.High; if (!String.IsNullOrEmpty(attachmentFilePath)) mail.Attachments.Add(new Attachment(attachmentFilePath)); using (var smtp = new SmtpClient()) { smtp.UseDefaultCredentials = true; smtp.Host = host; smtp.Send(mail); } } Thanks.