Solved

Sending email through smtp server (verifying email validity)

Posted on 2013-10-31
3
339 Views
Last Modified: 2014-11-12
We are sending email from our asp.net application to customers. but sometime we may have wrong email address of customers so it may bounce back.
so while i am sending the mail to the email address...is there a way i can know that the email address is valid

(for instance: to check if agorkhali@gmail.com is an existing email in gmail and another check is to see if agorkhali@somedomain.com is a valid domain name)

...so that we can log it in our database or for record purpose..so that we know that the email did not get sent out for that customer?

also, we would like to track if there is any bounce back of emails.


Attaching a simple test smtp email application just to show what i was trying to do.

and this thread reflect the exact same question i have.
http://social.msdn.microsoft.com/Forums/en-US/8ca20274-eb69-4f58-b735-45deb8e5631f/how-to-calculate-bounced-and-successful-email-in-c?forum=ncl

i am looking at what the alternative would be for this. (exchange server??) ,,


thanks
smtp.txt
0
Comment
Question by:agorkhali
  • 2
3 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
I'm pretty sure that you can't validate whether or not an email address exists before you send it.  You apparently can verify the domain with this:
http://sourceforge.com/projects/no-cdo  (taken from http://bytes.com/topic/c-sharp/answers/520083-how-process-categorize-bounced-email) . . . which would get you the right side of the "@"

To answer the 2nd part of your question, you can process the bounce backs.  You would set a reply-to in the email, and then a windows service to process the error messages.  Once you got a bounce back email, you could update or flag it so it doesn't go out again until it's modified.

Looking for freeware on how to do that, but no luck as of yet.
0
 

Author Comment

by:agorkhali
Comment Utility
thanks. Can i send the email through Exchange server instead of smtp relay server?
please let me know if you find the freeware.
0
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
To send via exchange:

From:
http://www.dreamincode.net/forums/topic/257676-sending-an-email-via-an-exchange-server/

using System.Net;  

using System.Net.Mail;  



             MailMessage message = new MailMessage();  

         message.To.Add("myemail");  

         message.Subject = "Test";  

         message.Body = "TESTING";  

         message.From = new MailAddress("myemail");  

         SmtpClient smtp = new SmtpClient("myexchangeserver");  

         smtp.UseDefaultCredentials = false;  // or set to true and skip setting Creds for current user.

         smtp.Credentials = new NetworkCredential("myemail","mypassword");  

         smtp.DeliveryMethod = SmtpDeliveryMethod.Network;  

         smtp.Send(message); 

Open in new window

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

New-MailboxSearch Powershell Command and step by step approach to Search and Extract Emails form Exchange 2013 Journaling server.
Whether you’re looking to gather data for research or gather feedback on an idea, being able to build and distribute your own online survey is not only cost-effective, but allows you to reach a larger audience and receive results in real-time. Googl…
This Micro Tutorial will demonstrate the easy use of Gmail embedding images in your email so the recipient of your email can view them in context.
By using UNIQUE function in Google Sheets, you can get around removing duplicates like in Microsoft Excel.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now