I am trying to send multiple mails using JAVA Mail -
When I add a single Recipient -
message.addRecipient(Message.RecipientType.TO, new InternetAddress(“[email protected]”));
It works fine, but not when I add multiple email addresses -
Here is the code
message.addRecipient(Message.RecipientType.TO, new InternetAddress(“[email protected]”));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(“[email protected]"));
message.addRecipient(Message.RecipientType.CC, new InternetAddress(“[email protected]"));
message.addRecipient(Message.RecipientType.CC, new InternetAddress(“[email protected]"));
message.addRecipient(Message.RecipientType.BCC, new InternetAddress(“[email protected]"));
The mail is sent and received, but when I check the email of [email protected]
I can't see that the email has also been sent to [email protected]
or vise versa. Neither I can see CC in the list.
Mail details from [email protected]
from: [email protected]
to: [email protected]
date: Thu, Sep 8, 2016 at 4:38 PM
subject: Test
Mail details from [email protected]
from: [email protected]
to: [email protected]
date: Thu, Sep 8, 2016 at 4:38 PM
subject: Test
Mail details from [email protected]
from: [email protected]
to: [email protected]
date: Thu, Sep 8, 2016 at 4:38 PM
subject: Test
Mail details from [email protected]
from: [email protected]
to: [email protected]
date: Thu, Sep 8, 2016 at 4:38 PM
subject: Test
I tried changing the logic a little, but same result -
message.addRecipients(Message.RecipientType.TO, InternetAddress.parse(“[email protected], [email protected]"));
message.addRecipient(Message.RecipientType.CC, InternetAddress.parse(“[email protected], [email protected]”));
message.addRecipient(Message.RecipientType.BCC, InternetAddress.parse(“[email protected]"));
I am expecting to see the details as -
from: [email protected]
to: [email protected], [email protected]
cc: [email protected], [email protected]
date: Thu, Sep 8, 2016 at 4:38 PM
subject: Test