Solved

Sending email through smtp server (verifying email validity)

Posted on 2013-10-31
3
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Suggested Solutions

Title # Comments Views Activity
Mailbox Delegation List 45 121
IIS Authentication Error 401 16 72
How do you think this website does searches? 5 34
Outlook 2016 6 58
Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Resolve DNS query failed errors for Exchange
This Micro Tutorial will demonstrate how marketers can use the Mobile Emulation Tool in Chrome Developer Tool. This will let you preview your site on any mobile device.
This Micro Tutorial will demonstrate using Google Doc how to import live data to another spreadsheet in Google Spreadsheets using the IMPORTRANGE function.

734 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