我想要订阅我的网站新闻通讯成员到我的谷歌群自动。
我尝试发送电子邮件到mygroupname+subscribe@googlegroups.com的主题和主体“订阅”由PHP邮件功能从用户电子邮件。但在我的组中没有任何结果和订阅请求。
$phpMailSender = new PHPMailer();
$phpMailSender->CharSet = "UTF-8";
foreach($users as $user) {
$phpMailSender->ClearAddresses();
$phpMailSender->From = $user['email'];
$phpMailSender->FromName = $user['email'];
$phpMailSender->AddReplyTo($user['email']);
$phpMailSender->addAddress('mygroupname+subscribe@googlegroups.com');
$phpMailSender->Subject = 'subscribe';
$phpMailSender->Body = 'subscribe';
$result = $phpMailSender->send();
if($result)
echo "Subscription email Sent for user# " . $user['email'] . "\n";
else
echo "Subscription email failed for user# " . $user['email'] . "\n";
ob_flush();
flush();
}有人能帮我吗?
发布于 2014-03-24 09:47:38
同时查看question in the hMailServer论坛。
那里的人给出了一些关于如何做到这一点的想法(尽管没有代码),但也有很好的考虑因素。
但是,除了向用户订阅列表之外,还有更多的事情要涉及。您还需要验证用户提供的电子邮件地址,这样人们就不会输入其他人的电子邮件地址。这将通过向用户发送电子邮件并要求他确认其订阅来完成。当他单击链接进行确认时,他会转到您的网页,该网页与某个数据库条目相关联,然后该电子邮件将以您正在尝试的方式添加到列表中。
但请查看我上面提供的链接,以了解更多考虑因素。
Here is another similar thread。
至于代码,there is a snippet here。
This thread also has some php code,和你的相似--你应该看看这个。
https://stackoverflow.com/questions/3695322
复制相似问题