Roundcube Community Forum

 

Injecting responds text when replying to a mail

Started by nlreeftank, November 15, 2012, 10:16:06 AM

Previous topic - Next topic

nlreeftank

Hi,

How can i do this?


When i open up a mail in roundcube i wanna parse the senders email and inject a text to the reply body of that mail.
Im a php programmer, just have to know in wich files i have todo this.


Greetz
Gerd

nlreeftank

I checked out the api of roundcube and found a hook i think i can use for this: message_compose

Where can i find a list of variables that i can use within the hooks?


nlreeftank

#3
any helping hand, why doesn this replace the body?

<?php
/**
 * veranderd_body
 * @version 1.0
 * @author Gerd K
 * @url http://www.domain.com
 */
class verander_body extends rcube_plugin
{

 
  public $task 'mail';

  function init()
  {
    $this->add_hook('message_compose', array($this'replace'));
  
  }


  function replace($args)
  {
    $args['body'] = "TEST TEST";
     return $args;
  }
}

?>

SKaero

The body is in $args['body'] if you do the following:

$args['body'] = "TEST TEST";

it will replace the body.

If you want prepend do the following:

$args['body'] = "TEST TEST" . $args['body'];

nlreeftank

#5
it doesnt seem todo that

<?php
/**
 * verander_body
 *
 * Sample plugin to replace emoticons in plain text message body with real icons
 *
 * @version 1.0
 * @author Gerd Koetje
 * @url http://www.pobb.nl
 */
class verander_body extends rcube_plugin
{

 
  public $task 'mail';

  function init()
  {
    $this->add_hook('message_compose', array($this'replace'));
  
  }


  function replace($args)
  {

$args['body'] = "TEST TEST";

  }
}


?>


same when i return args

in my config i have

$rcmail_config['plugins'] = array('verander_body');

SKaero

Reading back I see that you want to work with the reply, in which case you need to work use the message_compose_body hook.

nlreeftank

#7
that does the trick, thanks

how do i get the from variable from $this?

i tryed

$this->message->from;