cancel
Showing results for 
Search instead for 
Did you mean: 

Email to multiple users

ashwinis
Champ in-the-making
Champ in-the-making
Hi,

I want to send email notification to multiple users which means by cc,bcc as of now  MailActionExecuter.java supports sending email to and to_many.
is there any way we can achieve the same from java side?
also am trying to send email using to_many, it is not working as expected, how do i need to pass the value to to_many attribute.
If i use only TO, email is working fine.
1 REPLY 1

sanket
Champ on-the-rise
Champ on-the-rise
You can inject the mailService (org.springframework.mail.javamail.JavaMailSender) in your class and use the mailService to send email to - TO,CC,BCC.


        final MimeMessage mimeMessage = this.mailService.createMimeMessage();
        final MimeMessageHelper helper = new MimeMessageHelper(mimeMessage);

            helper.setSubject(subject);
            helper.setText(body, true);
            helper.setFrom(mailFrom);
            helper.setTo(mailTo);
            helper.setCc(mailCC);
           
            this.mailService.send(mimeMessage);