Dynamic email attachments in cakephp -


Is it possible to send an email with a dynamically generated attachment?

I tried it this way: $ this-> Email-> Attachment = Arrays ('Reservations .ics' = & gt; array (' Controller '= & gt;' reservation ',' verb '=> Ical', 'ext' => 'ics', $ this -> Data ['reservation'] ['id']));

But that does not work.

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.

In your controller, this may look like this:

  $ 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

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -