質問

I'm almost assuming this is a bug in JavaMail API.

I'm doing a myMessage.reply(true) to generate a new message. However, despite of the traditional "Reply To All" understanding, JavaMail is including myself (recipient of the first message, myMessage) as one of the recipients of the new message (created by the reply(true)). In any email application, doing a Reply to All doesn't add yourself to the new message.

It looks like a bug, no? Does anyone else have/had this same problem?

役に立ちましたか?

解決 3

The documentation is not clear enough. Do a for loop on getRecipients using the Recipient.TO as a parameter and then remove yourself from the reply Message instance.

他のヒント

JavaMail needs to know what your address is. It determines this using the InternetAddress.getLocalAddress method. See the javadocs for how this works. It then makes sure that your address doesn't appear in the recipient list of the new message. If it's not working for you, it's most likely because JavaMail doesn't know what your email address is.

In addition, in the JavaMail reference implementation, the Session property "mail.alternates" can be a list of other email addresses you're known by. Those will also be eliminated in the recipient list.

The javadocs says it clearly:

If replyToAll is set, the new Message will be addressed to all recipients of this message. Otherwise, the reply will be addressed to only the sender of this message (using the value of the getReplyTo method).

In a email client you usually (older OWA is not smart enough for example) have the smart behavior because the developers of such app tought about it and decided to make it so, but it is certainly not a bug in javamail.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top