Get the actual email message that the person just wrote, excluding any quoted text

后端 未结 6 1231
我寻月下人不归
我寻月下人不归 2020-12-23 17:34

There are two pre-existing questions on the site. One for Python, one for Java.

  • Java How to remove the quoted text from an email and only show the new text
6条回答
  •  难免孤独
    2020-12-23 18:13

    Just an idea: You have the text which was originally sent, so you can look for it and remove it and additional surrounding noise from the reply. It is not trivial, because additional line breaks, HTML elements, ">" characters are added by the mail client application.

    The regex is definitely better if it works, because it is simple and it perfectly cuts the original text, but if you find that it frequently does not work then this can be a fallback method.

提交回复
热议问题