Roundcube Community Forum

 

Add Attachment to Mail in compose window

Started by Loguithat1955, January 02, 2018, 08:58:11 AM

Previous topic - Next topic

Loguithat1955

Is there a function to add a attachment to a empty e-mail, when i have the full path of this attachment on the server? I have seen that there is a function rcmail_save_attachment(), but i allways get a Internal Server Error 500, if i try to use this. i tryed it with:

$attachment = rcmail_save_attachment($fullfilepath, null);


Loguithat1955

If I understand this correctly, this hook is executed when I click on the "create new mail" button. But I have already opened the new, mostly empty, mail. I have placed a new button in the attachment area. This brings me the path to a file stored on the server. This file should now to be attached to the already opened mail, identical to the function how I can attach new files via the normal upload.

Loguithat1955

I think, i have found a way to get what i need. But now i get the following error message "PHP Fatal error:  Uncaught Error: Call to undefined function rcmail_filetype2classname()" when i use:

$rcmail->output->command('add2attachment_list', "rcmfile$id", array(
            'html' => $content,
            'name' => $attachment['name'],
            'mimetype' => $attachment['mimetype'],
            'classname' => rcmail_filetype2classname($attachment['mimetype'], $attachment['name']),
            'complete' => true), $uploadid);


Do i have to include some file before?

Additionally i get the same error for rc_mime_content_type($filepath, basename($filepath))

alec


Loguithat1955

Ahhhh thx for this link. Now it works and i have released a new version of the storage plug-in.