Friday 31 December 2010 3:32:50 am
"
Solved my-self! the right line of code to add cc destinatary is : {set-block scope=root variable=email_cc_receivers}user@domain.com{/set-block} nothing more, nothing less. For further destinataries use "append-block" instead of "set-block" Enjoy! Daniele
"
Hi Daniele, yes, that code works fine, I knew about it from before, but it only works for one mail. My intention with previous post was to provide a way to have multiple cc and bcc receivers as there's no obvious way to define multiple cc addresses with set-block and append-block. Weird thing is, now that I'm trying my piece of code again, it doesn't work. And I could've sworn it was working couple of days ago. :( Kernel supports receiveing email_cc_receivers variable as an array, and if variable is not an array but a string, it just creates the array with PHP array function. So the solution is obviously to find a way to send email_cc_receivers as an array from template and set-block and append-block can't do that, they can only send the string variables. I've tried the following code on eZ Publish 4.3 & 4.4 and it didn't work:
{set-block scope=root variable=email_cc_receivers}user@domain.com{/set-block}
{foreach array('user2@domain.com', 'user3@domain.com') as $email}
{append-block scope=root variable=email_cc_receivers}{$email}{/append-block}
{/foreach} Now, {set-block scope=root variable=email_cc_receivers}user1@domain.com, user2@domain.com{/set-block} would be possible with a little kernel hack that replaces the array PHP function with explode PHP function, but I guess that's out of the scope here. Regarding your question about upgrading eZ Publish, you should definitely do it. 4.0.1 is a version more than two years old.
eZ Publish certified developer
http://ez.no/certification/verify/350658
|