Home All Groups Group Topic Archive Search About
Author
9 Apr 2007 8:06 PM
Gerhard
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.

Author
9 Apr 2007 8:46 PM
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

Show quote
"Gerhard" <acsla@community.nospam> wrote in message
news:D55A0E6E-6EFC-4F30-A34D-8AA78D265D43@microsoft.com...
>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.
>

AddThis Social Bookmark Button