Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to send emails to multiple recipients using sendMail service method

Hi,

I send mails from my precondition with the service method

    sendMail(MailSender sender, String toAddress, String subject, String msg, String cc)

For only one recipients it works fine, but I fail to use this method to send mails to multiple recipients. I tried it with comma separated mail addresses (with and without spaces e,g, address1@mail.de,adress2@mail.de) and with semicolon separated mail addresses. But every time I receive the following exception

javax.mail.internet.AddressException: Illegal address in string ``address1@mail.de,adress2@mail.de''

So, how must the toAdress parameter be formatted so that the mail will be send to multiple recipients?

Thanks and regards
Martin

0 votes


Accepted answer

Permanent link
Hello,

As a workaround:
you can chop down the string that contains multiple email addresses so that each piece contains only one email address. Then you can invoke the sendMail service method once for each email address.
Martin Wassermann selected this answer as the correct answer

1 vote

Comments

I think that will work too. If I find no other solution I will try to send a mail for each recipient. But I prefer to send one mail to multiple recipients.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Oct 01 '13, 7:19 a.m.

Question was seen: 14,325 times

Last updated: May 27 '15, 3:40 a.m.

Confirmation Cancel Confirm