Dynamic email attachments in cakephp -
Is it possible to send an email with a dynamically generated attachment?
I tried it this way: But that does not work. In your controller, this may look like this: $ this-> Email-> Attachment = Arrays ('Reservations .ics' = & gt; array (' Controller '= & gt;' reservation ',' verb '=> Ical', 'ext' => 'ics', $ this -> Data ['reservation'] ['id']));
attachments takes the path only in local files on the server, not the URL. You need to render your attachment in a temporary file, then attach it.
$ this-> AutoRender = false; $ Content = $ this- & gt; Render (); File_put_contents (TMP. 'Reservations'. $ Id. '.ics', $ content); $ This- & gt; Email-> Attachment = Array ('Reservation .ics' => TMP. 'Reservations'. $ Id '.ics');
Comments
Post a Comment