Add a temporary zip file as an attachment to an email

Hi Everyone,

How can I add a temporary file as an attachment to an email.

I am working on a plugin which create a temporary zip file containing ElggFile. How can I send the temporary zip file as attachement to an email.

The temporary zip file exists and contains all the ElggFile.

Here is my sample code.

$params['attachments'][] = [
        'filepath' => '<the temporary file path of the zip>', // i.e : /temp/download_I6jYwg.zip
];
notify_user($to_guid, $from_guid, $subject, $body, $params, ['email']);

 

The email is send but the attachment is not send.

Could someone help me ?

Regards,

 

 

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking