Author Topic: Reading cached message from database  (Read 1369 times)

Offline redhawk699

  • Newbie
  • *
  • Posts: 2
Reading cached message from database
« on: August 09, 2016, 11:26:04 AM »
Hi all, i've integrated Roundcube 1.2.1 into a CRM application and enabled the message caching feature in config.inc.php.
Now, i need to read the mail subject from the db. I see the messages stored in "cache_messages" but i'm wondering how to read the "data" column to extract the informations. As you can see in the attachment, there is an encoded/serialized string and i don't know how to read it. Anyone can help?
Thanks in advance!

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,344
Re: Reading cached message from database
« Reply #1 on: August 11, 2016, 02:09:53 AM »
are you using the rondcube framework? you can get how it works from rcube_cache->read_record() but basically I think you need to call rcube_db::decode()
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline redhawk699

  • Newbie
  • *
  • Posts: 2
Re: Reading cached message from database
« Reply #2 on: August 12, 2016, 06:10:10 AM »
I managed to read the data in another way: in rcube_imap.php, in the "fetch_headers" function, it's possible to read the headers because they aren't serialized yet. Here i extract the subject, date, id and sender in every header and insert them in a new table i created on the db. Now i can read what i need from another application by doing a sql select on "headers" table. :)