?
Solved

mail validate

Posted on 2011-03-09
7
Medium Priority
?
296 Views
Last Modified: 2012-05-11
Dear Team,

I m sending mail after my insert query but i want to delete my inserted record if my mail will not send.
How can i check my main delivered to receipent.

Please let me know.
0
Comment
Question by:virafh
[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
7 Comments
 
LVL 8

Expert Comment

by:vsudip
ID: 35080730
0
 
LVL 14

Expert Comment

by:robasta
ID: 35080817
There's no way to be 100% sure that a mail message has been received when sent via SmtpClient due to the way email works. The fact that SmtpClient doesn't throw an exception essentially means that you've done everything right, but a failure can happen further down the line, for example:

The receiving mail server could reject the mail
An intermediate mail server could reject the mail
The server that SmtpClient is transmitting mail through could decide to refuse to transmit the mail

use a try-catch like:

try
{
smtpClient.Send(emailMessage);
}
catch(Exception ex)
{
 // did not send (delete record) >> delete my inserted record if my mail will not send
}


see discussion here:
http://stackoverflow.com/questions/4973725/how-to-check-mailmessage-was-delivered-in-net
0
 

Author Comment

by:virafh
ID: 35081058
Dear robasta:

Thanks for ur response i am already using the try catch it is working fine.

But suppose someone typing abc@abc.com than try catch statement will validate this id.

I want if any user put any dummy id on that time our code validate.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Accepted Solution

by:
robasta earned 1000 total points
ID: 35081194
see here: http://www.codeproject.com/KB/validation/Valid_Email_Addresses.aspx

under: Validating via SMTP Handshakes

there is some sample code
0
 

Author Comment

by:virafh
ID: 35081329
thanks robasta i think your provided code will work for me
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 35944472
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

777 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