I had a strange problem with email sending through cakephp and postmark.
I have installed postmark-cakephp library in my cakephp application. I'm able to send email to single user and able to send email to multiple users with same email content (message) but here my requirement is I need to send email to multiple users with some dynamic email content. (contains user id)
I'm able to do this in a for loop but I want to send batch emails with dynamic content with a single call.
Here is my code
foreach($send as $client) {
//if client contains emails, send email
if(!empty($client['Email'])) {
//loop through emails
foreach($client['Email'] as $to) {
$client['message'] .= 'To be removed visit http://something.com/remove/'.$to."\n";
$client['message'] .= $message_footer;
$email_to = new CakeEmail();
$email_to->config('postmark');
$email_to->from('admin@something.com');
$email_to->to($to);
$email_to->subject($subject);
$email_to->send($client['message']);
}
}
}
Please help me out.