• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending Message help  RSS feed

 
Naba Barma
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
The following code snippet is for sending BCC mail. I have 100's of email ids in database, getting them from DB and setting those to bccAddress array. Eventually, email is send to all the id's at a time rather than putting in a loop and send the mails one by one. Works fine for correct email id's.
Now, my question is that....if there is a wrong email id within that array of emails, it does send the mails to the id's and displays sendMail failure exception. Basically i want to send mails to those with correct id's ignoring the wrong emails.
How can i track the wrong emails(not in a loop though), does anyone have any idea?
Thanks in advance!

[CODE]
try
{
ResultSet results;
results = query.executeQuery("select USER_EMAIL from EMAIL_GROUP_USERS where EMAIL_GROUP_ID = '" + multi.getParameter("alert_id") + "' and upper(nvl(opt_out,'N'))<>'Y' ");

Vector vAddress = new Vector();
while(results.next())
{

vAddress.add(new InternetAddress(results.getString("USER_EMAIL")));
}
InternetAddress[] bccAddress = new InternetAddress[vAddress.size()];
for (int i = 0; i < bccAddress.length; i++)
{
bccAddress[i] = (InternetAddress) vAddress.get(i);

}


msg.setRecipients(Message.RecipientType.BCC, bccAddress);
}

[CODE]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!