MailKit how to process returned emails

Forgive me as I’m new here if I’ve miscategorized this post.

My question is about MailKit on GitHub which is recommended by Microsoft instead of using the SmtpClient and how to correctly process email responses for rejected emails.

In the SmtpExamples MailKit/SmtpExamples.cs at master · jstedfast/MailKit · GitHub

There is

#region DeliveryStatusNotification
public class DSNSmtpClient : SmtpClient

Which is just overriding a couple of functions.
I think this is to send a message id and what failures you want to be returned from the receiving server.

Then in MailKit/MessageDeliveryStatusExamples.cs at master · jstedfast/MailKit · GitHub

public void ProcessDeliveryStatusNotification (MimeMessage message)

If I understand correctly.

I think then using POP3 or IMAP I use this method on the message to determine if it’s a status message and write out to the console what the status is for the failure.

Just want to confirm I’m understanding correctly.

My goal is to be able to send out some emails and process any rejections and log what those rejections are so to not email those email addresses again in the future.

.NET Foundation Website | Blog | Projects | Code of Conduct