Solved

mail validate

Posted on 2011-03-09
7
287 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now