How to send an email to multiple recipients in Spring

前端 未结 8 2220
花落未央
花落未央 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:35

    You can try this, instead of

    helper.setTo(to);
    
    String multipleEmailIds = "abc@abc.com, abc@abc.com"
    mimeMsg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(multipleEmailIds ));
    
    0 讨论(0)
  • 2021-02-12 11:35
    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
          <property name="host" value="smtp.ccc.corp"/>
          <property name="port" value="25"/>
          <property name="javaMailProperties"><props>
            <prop key="mail.smtp.sendpartial">true</prop>
          </props></property>
    </bean>
    

    set mail.smtp.sendpartial true. I am sure its work for you

    0 讨论(0)
提交回复
热议问题