Answer the question
In order to leave comments, you need to log in
How to send emails to multiple users in Spring?
Hello!
How to send emails to multiple users? When creating an article, you need to send messages to different users. Now, according to my code, the message only comes to the last user...
Here is the code:
public void sendMails (String[] to, String subject, String body) throws MessagingException {
MimeMessage message = javaMailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper( message, true );
helper.setFrom(from);
helper.setTo(to);
helper.setSubject(subject);
helper.setText(body);
javaMailSender.send(message);
}
Answer the question
In order to leave comments, you need to log in
The correct tone would be to send a separate email to each user . Firstly, no one will know the number of subscribers, and secondly, the letter must be personalized.
Well, at least try using apache commons email - https://commons.apache.org/proper/commons-email/in...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question