时事通讯 - BBC 和取消订阅链接
时事通讯表:
id | email | unsubscribe_link
$emails = NewsletterTable::getInstance()->findAll();
$count = count($emails);
$message = $this->getMailer()->compose();
$message->setSubject($params['subject']);
$message->setTo($params['to']));
$message->setFrom($params['from']);
for($i=1;$i<$count;$i++){
$message->addBcc($emails[$i]->email);
}
$html = $this->getPartial('mymodule/myTemplateHtml',$params);
$message->setBody($html, 'text/html');
$text = $this->getPartial('mymodule/myTemplateTxt',$params);
$message->addPart($text, 'text/plain');
$this->getMailer()->send($message);
我必须为此添加什么并发送取消订阅链接(唯一)?有可能吗?
Newsletter Table:
id | email | unsubscribe_link
$emails = NewsletterTable::getInstance()->findAll();
$count = count($emails);
$message = $this->getMailer()->compose();
$message->setSubject($params['subject']);
$message->setTo($params['to']));
$message->setFrom($params['from']);
for($i=1;$i<$count;$i++){
$message->addBcc($emails[$i]->email);
}
$html = $this->getPartial('mymodule/myTemplateHtml',$params);
$message->setBody($html, 'text/html');
$text = $this->getPartial('mymodule/myTemplateTxt',$params);
$message->addPart($text, 'text/plain');
$this->getMailer()->send($message);
What i must add for this that send also unsubscribe_link (unique)? Is possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信你正在使用教义。我不是如何用学说做到这一点的专家,但作为黑客,你可以这样做:
这里的想法是创建一个电子邮件地址字典,并且重复不会影响它,因为字典不能有重复条目。然后,循环遍历字典的键并添加它们。
I believe you're using Doctrine. I'm not an expert in how to do this with doctrine, but as as hack you could do this:
The idea here would be to create a dictionary of email addresses, and duplicates wouldn't affect it since dictionaries can't have duplicate entries. Then, loop through the keys of the dictionary and add them.