.net - How to know if Email failed to reach its receivers -


After

I am sending the email using the following utility class if receiver foo@foo.com does not exist or email to him Never reach for one reason or another, I want my application to be notified.

This only works when smtp customer failed to connect to the SMTP server, I am an exception in this case; otherwise, the only way is by checking the client account to the email client To know if unsuccessful to reach.

EmailUtil Public Stable Class {/// & lt; Summary & gt; /// string is empty or empty, if exception of fire goes /// & lt; / Summary & gt; /// & lt; Param name = "param" & gt; Absolute value & lt; / Param & gt; /// & lt; Param name = "paramName" & gt; The parameter name shown in the exception message & lt; / Param & gt; Private static void CheckStringParam (string parameter string ParamName) {if (String.IsNullOrEmpty (parameters)) (paramName String.Format ( "{0} can not be null or empty")) {throw new ArgumentException; }} Public static void SendEmail (EmailArgument emailArg) {CheckStringParam (emailArg.FromEmail, "emailArg.FromEmail"); CheckstringParam (EmailArg. Shoes, "EmailArg. Shabez"); Check ProcessingParam (Email Order Body, "Email Ag. Body"); String body = email erg Body; MailMessage Mail Message = New MailMessage (); MailMsg.From = New MailAddress (emailArg.FromEmail); Foreach (string recipient in emailArg.ToEmails) {if (String.IsNullOrEmpty (recipient)) {New ArgumentException throw ("one of the values ​​in emailArg.ToEmails array is empty or empty"); } MailMsg.To.Add (new mail address (recipient)); } MailMsg.IsBodyHtml = emailArg.IsHtml; If (emailArg.PutHtmlTags) {body = String.Format ("{0}" + body + "{1}", " gt; body

Note that if you add a header to the message that you want you want, you can get an email back (like I said - possibly later on) from some SMTP server Delivery failed in kind

Positive Acceptance The message that was received, the customer can be configured or the instructions can not be sent.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -