Hi all, it's possible to have an example script to attach file to a new email at runtime?
Thanks
On Mon, Jul 27, 2009 at 12:04 PM, Sandro Pazzisandro@idweb.it wrote:
Hi all, it's possible to have an example script to attach file to a new email at runtime?
Thanks
By "at runtime", do you mean an ajax-upload like Google Mail does it when you add an attachment?
Till _______________________________________________ List info: http://lists.roundcube.net/dev/
Hi Till, with "at runtime" I mean a way to open the new message page with just attacched a file, passing at the new message page the absolute path of file.
Thanks
On Mon, 27 Jul 2009 21:21:34 +0200, till klimpong@gmail.com wrote:
On Mon, Jul 27, 2009 at 12:04 PM, Sandro Pazzisandro@idweb.it wrote:
Hi all, it's possible to have an example script to attach file to a new email at runtime?
Thanks
By "at runtime", do you mean an ajax-upload like Google Mail does it when you add an attachment?
Till
Hey Sandro,
On Wed, Jul 29, 2009 at 10:48 AM, Sandro Pazzisandro@idweb.it wrote:
Hi Till, with "at runtime" I mean a way to open the new message page with just attacched a file, passing at the new message page the absolute path of file.
Thanks
I don't see a hook that would perform that kind of thing currently. Can you detail what you need this for so we understand the use case? :)
Till
On Mon, 27 Jul 2009 21:21:34 +0200, till klimpong@gmail.com wrote:
On Mon, Jul 27, 2009 at 12:04 PM, Sandro Pazzisandro@idweb.it wrote:
Hi all, it's possible to have an example script to attach file to a new email at runtime?
Thanks
By "at runtime", do you mean an ajax-upload like Google Mail does it when you add an attachment?
Till
-- Sandro Pazzi
IdWeb s.r.l. Viale Romagna 69/A - 06012 Citta' di Castello (PG) Tel. 075 851 97 28 Fax 075 851 97 30 _______________________________________________ List info: http://lists.roundcube.net/dev/
List info: http://lists.roundcube.net/dev/
Hi Till, I'm integrating RC with our CRM. Would be usefull create a button like "send invoice" in our CRM that open the RC new message page with the "to" field compiled and the invoice attacched. I can pass the absolute path of file and also the binary.
Thanks
On Wed, 29 Jul 2009 14:52:53 +0200, till klimpong@gmail.com wrote:
Hey Sandro,
On Wed, Jul 29, 2009 at 10:48 AM, Sandro Pazzisandro@idweb.it wrote:
Hi Till, with "at runtime" I mean a way to open the new message page with just attacched a file, passing at the new message page the absolute path of file.
Thanks
I don't see a hook that would perform that kind of thing currently. Can you detail what you need this for so we understand the use case? :)
Till
On Mon, 27 Jul 2009 21:21:34 +0200, till klimpong@gmail.com wrote:
On Mon, Jul 27, 2009 at 12:04 PM, Sandro Pazzisandro@idweb.it wrote:
Hi all, it's possible to have an example script to attach file to a new email at runtime?
Thanks
By "at runtime", do you mean an ajax-upload like Google Mail does it when you add an attachment?
Till
-- Sandro Pazzi
IdWeb s.r.l. Viale Romagna 69/A - 06012 Citta' di Castello (PG) Tel. 075 851 97 28 Fax 075 851 97 30 _______________________________________________ List info: http://lists.roundcube.net/dev/
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
--- 8< --- detachments --- 8< --- The following attachments have been detached and are available for viewing. http://detached.gigo.com/rc/Ts/UQaYpHnC/compose_attach.php Only click these links if you trust the sender, as well as this message. --- 8< --- detachments --- 8< ---
List info: http://lists.roundcube.net/dev/
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
Sandro Pazzi wrote:
I Thomas, I've tested your sample. Here my code:
After reading your code quickly, I think the command $args['attachments'] = array(array('path' => $tempPath, ...));
should be $args['attachments'] = array(array('path' => $tmpfname, ...));
The 'path' argument expects the full path to the attachment file but with $tempPath you only specify the directory.
~Thomas _______________________________________________ List info: http://lists.roundcube.net/dev/