SmtpMail

G

Guest

I have an application that uses SmtpMail.

As part of that, I want a notification emailed to the sender on any failure.
I am using:

Dim SmtpMail As Mail.SmtpClient = New
System.Net.Mail.SmtpClient(ConfigurationManager.AppSettings("strSmtpServer"))
Dim MyMail As System.Net.Mail.MailMessage

(code to populate To, From etc)

MyMail.DeliveryNotificationOptions =
Mail.DeliveryNotificationOptions.OnFailure
SmtpMail.Send(MyMail)

Which works great except on internal emails on the local Exchange server, in
which case an exception gets thrown (Mailbox unavailable. The server
response was: 5.1.1 User unknown) but the email gets sent anyway. Is there
anyway to suppress this exception, and have a notification email sent instead
like it does on an external email that is not valid?

Thanks.
 
H

Henning Krause [MVP - Exchange]

Hello,

your Exchange server is configured to not accept mails for unknown users.
You have two choices here: Create a delivery-report on your own and send
that to the original sender of the mail, your get your admin reconfigure
Exchange to accept all mails (which I wouldn't do in the admins position)...

Best regards,
Henning Krause
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top