Solved

mail validate

Posted on 2011-03-09
7
294 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
Technology Partners: 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 250 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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!
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 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