Sorry if this is a foolish question but i just started using roundcube.
I want to make a plugin that can query a database for email templates we store there.
I can't figure out how to pass arbitrary arguments to the compose window to then parse in my compose_message hook.
I tried passing in a string like this: in JS
rcmail.command('compose','template=1&to=TEST@example.com&templateid=523',this.event)
but it:
a) placed that string in the 'to' field and i can't explode on '&' to figure it out
b) opens up multiple compose windows instead of just the 1.
so far my plugin looks like:
class template_compose extends rcube_plugin{
public $task = 'mail';
function init() {
$this->add_hook('message_compose', array($this, 'use_template'));
}
function use_template($args) {
$params = array(
'param' => array(),
'attachments' => array()
);
if(isset($args['param']['to'])){
//need to split the to param into parts
$to = $args['param']['to'];
$strings = explode("&",$to);
foreach($strings as $val){
error_log($val);
}
}
return $params;
}
}
any help would be greatly appreciated.