Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have a code below sending email to the Distribution list(DL).But one of the recipient email address is invalid in the DL.I was unable to send the email to the valid email addresses atleast.

My question is how can i send the email to valid recipients in .net 1.1 even if there is invalid email address in the DL.I am getting the exception like this:
The server rejected one or more recipient addresses.

code in 1.1

VB
Dim mail As New MailMessage()
mail.To = "abc_DL@one.com"
mail.From = "strust@one.com"
mail.Subject = "This is test mail"
SmtpMail.SmtpServer = "smtp.one.com"
SmtpMail.Send(mail)

But in my sample code below 2.0 application i am able to send the email to the recipients with correct address even if there is wrong address(junkmail@one.com)along with the DL mentioned

code 2.0
Namespace used

VB
Imports System.Net.Mail

Dim mail As New MailMessage()
mail.[To].Add(abc_DL@one.com,junkmail@one.com)
mail.From = New MailAddress(strust@one.com)
mail.Subject =This is test mail to the distribution List
mail.Body = This is a test mail.Please ignore
Dim smtp As New SmtpClient(smtp.one.com)
smtp.Send(mail)

Thanks,
Priya
Posted
Updated 14-Aug-12 11:08am
v2
Comments
Kenneth Haugland 14-Aug-12 17:12pm    
Check the mail response and cach the exception?

1 solution

Are you sure it is not sent ? A mail server can send back a report that a mail bounced, but it's very odd for the mail class to be able to notice, and it gets it AFTER it was sent, so your mail should have been sent, all the same.

If there's an issue in the .NET 1.1 mail classes, then perhaps you need to get your list, and send a mail to each person ? I assume any issue exists because this is an internal mail server that behaves strangely.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900