As others have said before, the SMTP protocol does not guarantee that the message will be delivered, nor that the Email Client will send a notification that the message has been received.
However, some email clients (such as Outlook
or the Thunderbird
) are capable of interpreting the Header Disposition-Notification-To
and send a notification.
public void PrepararNotificacoes(ref MailMessage mensagem)
{
mensagem.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure | DeliveryNotificationOptions.OnSuccess | DeliveryNotificationOptions.Delay;
mensagem.Headers.Add("Disposition-Notification-To", "[email protected]");
}
In this case the notification will not be sent to a URL, but to an email, and even if the email is received, there is no guarantee that the notification email will be sent or that it will reach its destination.
As an alternative to automate this process, you can create a POP3 service that receives the notification emails, this service can write to your Bank, create a WCF Client, etc... in this way you could register that the email was read.
@Marconi, if all your customers use an Email Client (like Outlook, Thunderbird, etc), you can set the property
MailMessage.DeliveryNotificationOptions
forDeliveryNotificationOptions.OnSuccess
and add a notification email to the propertyMailMessage.ReplyToList
– Tobias Mesquita
@Tobymosque Send see in a reply, may help someone. Unaware of these properties.
– Marconi
@Marconi, I honestly do not find this property very useful, it basically sends you a confimation email and works only if the User uses a non-web Email Client.
– Tobias Mesquita
@Tobymosque understood, more anyway is already a great help.
– Marconi