Is there a way to find out if an email was sent successfully using C #?

Is there a way to find out if an email was sent successfully using C #?

I am using System.Net.Mail.

+3
source share
3 answers

set MailMessage DeliveryNotificationOptions to use in
System.Net.Mail.DeliveryNotificationOptions.OnSuccess;

or try:

static void ReadReceipts()
{
//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("me@mycompany.com");
mail.To.Add("you@yourcompany.com");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";

//To request a read receipt, we need add a custom header named 'Disposition-Notification-To'
//in this example, read receipts will go back to 'someaddress@mydomain.com'
//it important to note that read receipts will only be sent by those mail clients that 
//a) support them
//and
//b)have them enabled.
mail.Headers.Add("Disposition-Notification-To", "<someaddress@mydomain.com>");


//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
}
+2
source

Only a way to find out if someone received an email, ask them to tell you in any way (read reciept or the like).

That's why all email confirmation schemes always have that you need to click the link to confirm that it is your email.

+2
source

, Postmark, smtp api -.

Postmark uses PowerMTA , an email gateway capable of detecting unwanted markings, bounces, etc. You can go directly through PowerMTA, but Postmark wrap it all well.

+2
source

Source: https://habr.com/ru/post/1765264/


All Articles