Roundcube Community Forum

Miscellaneous => Roundcube Discussion => Topic started by: Martin Schrimpf on August 16, 2012, 05:51:44 AM

Title: [Plugin] Read message on button click
Post by: Martin Schrimpf on August 16, 2012, 05:51:44 AM
Hello,

i am currently writing a Plugin for Roundcube which has the purpose to generate a PDF from a message.
But i can't figure out how to read the (currently opened) message on button click.

Google doesn't really help - i tried to solve the problem by reading the code of other plugins but didn't come to a solution yet.

I hope, somebody can help.

Best Regards,
Martin
Title: Re: [Plugin] Read message on button click
Post by: SKaero on August 16, 2012, 08:09:36 PM
I think there is two ways to do this:
1. Start another imap request and get the message again.
2. Get the message using JS and send it back to the plugin.
Title: Re: [Plugin] Read message on button click
Post by: Martin Schrimpf on August 17, 2012, 03:39:00 AM
Hi SKaero,

thank you for your reply!

The second way with JS you mentioned would be the preferred one here.
Unfortunately, i cannot find a way to read the message with JS (at least not in a comfortable way, we only found a way to read the message from the site-html) - could you give me some further help?

Best Regards,
Martin
Title: Re: [Plugin] Read message on button click
Post by: SKaero on August 17, 2012, 06:49:03 AM
Well with the JS method you would have to get the formatted html version, but isn't that what you would want to make the pdf? How do you want the message formatted?
Title: Re: [Plugin] Read message on button click
Post by: Martin Schrimpf on August 24, 2012, 03:31:52 AM
We solved it by getting the raw body with

rcmail->storage->get_raw_body()

and converting the result to HTML with a MailParser (http://code.google.com/p/php-mime-mail-parser/).

Thank you for your help!
Title: Re: [Plugin] Read message on button click
Post by: Volnhar on August 30, 2012, 09:37:58 PM
Hi,

I would be interested in having a look at this plugin as well. Sounds really handy when you want to get a pdf copy of your messages.