+1 vote

I am using your Mail.dll - .NET email component, I have this issue:
- I tried to send an email (using SMTP client into C# project) from an account PEC (certified email) to a wrong/not existing standard address;
- I haven't received any notification of "delivery failure" or "destination address wrong";
- The flag result (ISendMessageResult result) was true;

Can I receive into Inbox of the sender a notification like "destination address wrong"?
Can I check a flag of status in your Mail.dll, that inform me about the delivery failure?

Note: my Company has purchased a licence (with on e year support); if the support period is expired, we can buy a new support licence.

by
edited by

1 Answer

0 votes
 
Best answer

In some simple cases your SMTP server will inform you that the recipient address is wrong immediately. Those cases include:

  • wrong email format.
  • non-existent email address that is in the same domain (hosted on the same server)

You will get such error in ISendMessageResult object returned by Smtp.SendMessage method.

In many other cases your SMTP doesn't know if the address is valid or not. It needs to start trying to deliver your message - technically it needs to connect to the recipient's SMTP server first
(this of course happens some time after your (Mail.dll's) interaction with your SMTP server finished).

If the recipient's server doesn't exist (e.g. mailbox@no-such-domain.com) -or- email address is not correct (e.g. no-such-mailbox@gmail.com) error is raised, bounce message is generated and is send back to you.

Such messages are called Delivery Status Notification or DSNs for short.

You can use Imap component to receive such error messages, you can use Bounce class to recognize and parse them:
https://www.limilabs.com/blog/bounce-handling

a very good idea is to use VERP:
https://www.limilabs.com/blog/verp-variable-envelope-return-path-net

by (298k points)
...