Solved

Sending email through smtp server (verifying email validity)

Posted on 2013-10-31
3
350 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 40

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 40

Accepted Solution

by:
Kyle Abrahams earned 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
This Micro Tutorial demonstrates in Google Analytics how to create a custom report that shows you traffic over time using the month of year dimensions. There are also instructions on how to fix Google's odd month of year formatting, which Microsoft …
This Micro Tutorial will demonstrate Google Calendar to monitor updates with top sites, such as Facebook, Google, Twitter, etc. with Marketing News. Each update of Google Calendar can be monitored, correlate dips and spikes in your website traffic, …

821 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