[Users] Python scripts questions: message bodies and message view

Holger Berndt berndth at gmx.de
Sat Aug 26 01:48:00 CEST 2017


Hallo MJ,

On Mo, 21.08.2017 19:32, MJ Ray wrote:

>I'm trying to do some text processing on a selection of messages and
>display the result.
>
>Is it possible to get the message body as a string in python plugin
>scripts? I can open the FilePath and parse it but I'm not sure that's
>the best approach because I expect that clawsmail has already parsed it.

You get some information that Claws Mail has cached about the message
(like subject and flags) as attributes of the MessageInfo class
instance. If you need the full body, it's actually best to take the
file path and parse it yourself (or rather, use standard Python
email modules to do it for you).

>The other thing I'd like to know is how to edit/replace the contents of
>the message view area - is that possible?

No. I am not sure if it'd be a good idea to let scripts put random
stuff in the message view.. You'd have to open your own window for your
output.

Holger



More information about the Users mailing list