0

I want to strip the entire past mails to get the original mail body without any quotations using MailKit/MimeKit.

Getting the mails (via IMAP) is already done and working fine. But in case of a replying mail, the history of the written mails should be completely removed to get the original mail body by itself. The mainly used mail client is Outlook (customer), but also Thunderbird is in use of the support team.

I know, that there is this question, but this solves only the part for building the mail body for a reply (with all existing messages as quotation).

This functionality would be used for a ticket system.

How would you folks handle the deletion of the quotation from outlook?

(And maybe a more Outlook behavior of adding the existing mails as a quotation)

Community
  • 1
  • 1
SiL3NC3
  • 690
  • 6
  • 29

1 Answers1

1

It sounds like what you want to do is the reverse of the other question.

The simple answer to that is to remove all lines that begin with ">" (or perhaps more specifically, lines that begin with "> ").

Then you'll also want to remove the line above the first line starting with a ">" (or "> ") - at least if it seems to have a date string in it.

Unfortunately it's not likely that a library exists to do this, so you'll probably have to write your own logic, but I could be wrong.

Hope that helps.

jstedfast
  • 35,744
  • 5
  • 97
  • 110
  • This probably work reasonably for text emails but not for HTML emails which are often quoted rather differently. Existing solutions I've seen to this often involve javascript and Dom manipulation... – Max Oct 22 '15 at 02:48
  • Correct, but since every client probably does HTML mail quoting differently, it'll likely be pretty complicated. – jstedfast Oct 22 '15 at 22:11