gpt4 book ai didi

java - java中如何向多个地址发送电子邮件

转载 作者:行者123 更新时间:2023-12-02 05:32:59 25 4
gpt4 key购买 nike

我使用此方法向两个 Gmail ID 发送电子邮件,但出现错误:

The method addRecipient(Message.RecipientType, Address) in the type Message is not applicable for the arguments (Message.RecipientType, Address[])

如何向多个 ID 发送电子邮件?

 Address toaddress[] = new InternetAddress[2];
toaddress[0] = new InternetAddress(mail_to_0);
toaddress[1] = new InternetAddress(mail_to_1);
message.addRecipient(Message.RecipientType.TO,toaddress);

最佳答案

使用 addRecipients(Message.RecipientType type,Address[] addresses) 怎么样?

 Address toaddress[] = new InternetAddress[2];
toaddress[0] = new InternetAddress(mail_to_0);
toaddress[1] = new InternetAddress(mail_to_1);
message.addRecipients(Message.RecipientType.TO,toaddress);

关于java - java中如何向多个地址发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25346666/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com