我在通过 cakephp 和邮戳发送电子邮件时遇到了一个奇怪的问题。
我已经在我的 cakephp 应用程序中安装了postmark-cakephp 库。我能够向单个用户发送电子邮件,并且能够向具有相同电子邮件内容(消息)的多个用户发送电子邮件,但在这里我的要求是我需要向具有一些动态电子邮件内容的多个用户发送电子邮件。(包含用户 ID)
我可以在 for 循环中执行此操作,但我想通过一次调用发送包含动态内容的批量电子邮件。
这是我的代码
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']);
}
}
}
请帮帮我。