質問

When sending emails via javamail, the following is always appended to the bottom of each message:

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

How does one prevent this?

(NOTE: This problem is extremely frustrating to research on the web due to the fact that a disclaimer of this form is attached to so many indexed documents! :-(

役に立ちましたか?

解決

JavaMail is not doing that, it is your outgoing SMTP server appending it to each message, probably set up by IT.

To confirm, you can use gmail's servers (with a personal account) and you will see it does not get added to the messages.

他のヒント

This should work. Pay attention to the form in which email body get parsed. In my case the emailBody string is on one line, so you have to put the "#Your disclaimer Here#" on one line. Answer for who will come in future.

public String deleteDisclaimer(String emailBody) {

                String disclaimer = "#Your disclaimer here#";

                if (emailBody.contains(disclaimer)) {
                    System.out.println("Deleting Disclaimer..");
                    return emailBody.substring(0,emailBody.indexOf(disclaimer));
                }
                System.out.println("DISCLAIMER NOT FOUND!");
                return emailBody;
            }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top