Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sending email through smtp server (verifying email validity)

Posted on 2013-10-31
3
Medium Priority
?
372 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 41

Expert Comment

by:Kyle Abrahams
ID: 39614997
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
ID: 39615111
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 41

Accepted Solution

by:
Kyle Abrahams earned 2000 total points
ID: 39615215
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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Phishing emails are a popular malware delivery vehicle for attack.  While there are many ways for an attacker to increase the chances of success for their phishing emails, one of the most effective methods involves spoofing the message to appear to …
This Micro Tutorial will demonstrate importing calendar invites from events such as webinars into your Google Calendar.
This Micro Tutorial will demonstrate common damaging and frequent mistakes I see in most analytic audits. Most of them are campaign tagging mistakes, so this video will break it down into simple steps.
Suggested Courses

971 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