Java邮件在To和Cc列表中发送电子邮件时重复发送 [英] Java Mail sent repeated email when the email in To and Cc List
本文介绍了Java邮件在To和Cc列表中发送电子邮件时重复发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现,当我的电子邮件地址同时包含 TO
列表和 CC
列表。
I found that my Application will send email to me twice when my Email Address is in both TO
List and CC
List.
如何控制只发送到同一个电子邮件地址的邮件一次,但保留地址在 TO
和 CC
列表?
How to control the email only sent to the same email address by once but keeping the address is in TO
and CC
List?
transport.connect();
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.CC));
transport.close();
推荐答案
对不起,我通过以下方式解决了问题: >
Sorry, i solved the problem by :
transport.connect();
transport.sendMessage(message, message.getAllRecipients());
transport.close();
我不知道有一个功能: message.getAllrecipients()
因为我试图使用其他人的编码。我认为问题已经解决了。
I don't know there is a function : message.getAllrecipients()
because i tried to use other's coding. I think the problem has been solved.
这篇关于Java邮件在To和Cc列表中发送电子邮件时重复发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文