Author Topic: Copy email message to database  (Read 2444 times)

Offline mstorey

  • Newbie
  • *
  • Posts: 3
Copy email message to database
« on: August 08, 2016, 04:23:09 AM »
Hello Friends,
I'm very new to RoundCUBE. I must quickly hack some code together that will enable users to select individual emails (one at a time), permitting them to store the email into a database in its component parts.
They will have the ability to link the email with individual clients.

I've put together the very very basic shell for the plugin with a button on the toolbar.

Would someone please provide and/or direct me to the relevant code which reads the email (header, body etc etc)

Many thanks in advance.

Offline alec

  • Hero Member
  • *****
  • Posts: 1,365
Re: Copy email message to database
« Reply #1 on: August 08, 2016, 04:52:46 AM »
$MESSAGE = new rcube_message($uid, $folder);

Offline mstorey

  • Newbie
  • *
  • Posts: 3
Re: Copy email message to database
« Reply #2 on: August 08, 2016, 08:42:40 AM »
Thank you Alec, :D
Great and quick response.
I've been playing with the code below ...

      $uid = '*';
      $uid = "2728";
      $folder = 'inbox';
      $MESSAGE = new rcube_message($uid, $folder);
      
      //echo $MESSAGE->headers->messageID;
      //echo $MESSAGE->headers->uid;
      //echo '<br>Subject '.$MESSAGE->headers->subject;
      //echo '<br>Size '.$MESSAGE->headers->size;
      //echo '<br>Folder '.$MESSAGE->headers->folder;
      //echo '<br>From '.$MESSAGE->headers->from;
      //echo '<br>To '.$MESSAGE->headers->to;
      //echo '<br>Date '.$MESSAGE->headers->date;
      //echo '<br>TEXT<br> '.$MESSAGE->first_text_part();
      //echo '<br>HTML<br> '.$MESSAGE->first_html_part();


I'm finding the appropriate methods etc.

How do I get the  $uid when clicking on the email?
Manual entry obviously needs to be dynamic   eg $uid = '*';  or $uid = "2728";

My goal is to allow right click or click on email and select from toolbar menu to complete the operation.

Many thanks.
regards
Mark