How to send an email to multiple recipients in Spring

前端 未结 8 2241
花落未央
花落未央 2021-02-12 10:48

The email gets sents only to the last email address in the String[] to array. I\'m intending to send to all email addresses added to the array. How can I make that

8条回答
  •  遇见更好的自我
    2021-02-12 11:31

    You have the choice to use the following 4 methods. I have provided examples of the two methods useful in this case. I have consolidated this information from the commentators below.

    helper.setTo(InternetAddress.parse("email1@test.com,email2@test.com"))
    helper.setTo(new String[]{"email1@test.com", "email2@test.com"});
    

提交回复
热议问题