I am trying to build code to send a news flash to external subscribers to our site. I have their email addresses in a variable called bcc_list and the news flash in a variable called messagehtml. I cannot send the update to them in one go, since I would like to include an unsubscribe link into the news flash e-mail. As a consequence each e-mail must be personalised for the unsubscribe link and so I need to loop over the e-mail addresses.
Here's my code so far to achieve this:
My problem is, how can I include the email address as stored in $email in the couch tag in the php code?
The code as shown above does not work. Also, first setting the email address with cms:set and then using it in send_mail using cms:show does not seem to work. Any ideas? All help appreciated!
Here's my code so far to achieve this:
- Code: Select all
<cms:php>
$emaillist=explode(',',<cms:show bcc_list />);
foreach ($emaillist as $email) {
<cms:send_mail to=$email from='me@example.com' subject="<cms:show messagesubject />" html='1'>
<cms:show messagehtml />
<...some code to generate the unsubscribe link and add it to the e-mail...>
</cms:send_mail>
}
</cms:php>
My problem is, how can I include the email address as stored in $email in the couch tag in the php code?
The code as shown above does not work. Also, first setting the email address with cms:set and then using it in send_mail using cms:show does not seem to work. Any ideas? All help appreciated!