C# – Email not being sent to certain email addresses using SmtpClient


I have created a simple asp.net email form for a client, which is sending off emails using the SmtpClient class. It is very basic and works in most instances.

The form is used in a number of websites but it only works intermittently. The code always works and does not throw any exceptions, it just works correctly but intermittently and for certain clients, the email never reaches the To address. If changes to an external email (e.g. my personal Hotmail account) it works correctly.

We have asked the recipients to check their spam inboxes but to no avail. How would one be able to track this issue? How can I know that my clients asp.net server has sent the email (in which case the problemm is at the recipients end) or not?

Best Solution

Look at the headers in the e-mail you got in your hotmail account and see what the From: and Reply-To: fields are set to.

Then look through your source code to compare with what you're asking it to be set to.

You might be getting a bounce message from an SMTP server (yours or another one en route to the destination) and it might be sent to the From: address of the e-mail.

Check that you have code to handle exceptions, test with incorrect details and see what StatusCode returns.

Related Question