So here is the scenario:
I have a newsletter subscription form, the potential subscriber can choose the format of the newsletter, that is, html or plain. In the backend administration, the newsletter is created in two formats, plain and html.
Basically when sending the newsletter, I have to decide which newsletter format I should send to a particular subscriber.
Suppose I have an array from the database, something like that:
Code: Select all
$subscribers = array(0=>'email'=>'...@domain.tld','format'=>'plain',1=>'email'=>'...@domain.tld','format'=>'html',..);Now here comes my question, what's the best practice to do the send ?
Should I loop through the subscribers array do a conditional test and call send() with the appropriate newsletter' content for each subscriber ? or Should I split the subscribers list in two categories, html and plain, and call send twice ? or is there a Swift way of handling this ?
The decorator plugin is for decorating the message, in this case it's different because I want to tell it: send $plainNewsletter for this subscriber and send $plainNewsletter ( text/html ) for that other subscriber.
Any thoughts ?
Thanks in advance.