I Thomas, I've tested your sample. Here my code:
$this->add_hook('message_compose', array($this, 'message_compose')); function message_compose($args) { unset($_SESSION['plugins']['idcustomer_attachments']['tmp_files']); $tempPath = './TEMP'; if ($args['param']['attach']) { $temp_dir = realpath($tempPath); $tmpfname = $temp_dir.'\'.$args['param']['file']; if(file_exists($tmpfname)) { $args['attachments'] = array(array('path' => $tempPath, 'name' => $args['param']['file'], 'mimetype' => 'application/pdf')); } else $args['param']['body'] = 'file not found'; }
return $args;
}
The code was in a more complex plugins. I get no error on sending, but the recived email has not the attached file.
I've also proved with the realpath because I've RC in a windows server, but with same result.
Any idea?
Thanks
On Wed, 12 Aug 2009 13:58:16 +0200, Thomas Bruederli roundcube@gmail.com wrote:
Hello Sandro
Since revision 2856 it's possible to inject attachments when opening the
compose step. See http://trac.roundcube.net/wiki/Plugin_Hooks#message_compose for a description of the according hook.
Find attached a sample plugin which will add the README file as
attachment
when calling /?_task=mail&_action=compose&_attach=true
I hope this is what you need for your CRM system.
Regards, Thomas