通过 PHP 进行 Google 群组订阅
我想自动将我的网站简讯成员订阅到我的 Google 网上论坛。
我尝试发送电子邮件至 [email&n bsp;protected] 与主题 &正文通过 PHP Mail 函数从用户电子邮件中“订阅”。但我的小组中没有任何结果和订阅请求。
$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('[email protected]');
$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();
}
任何人都可以帮助我吗!
I wanna subscribe my website newsletter members to my Google Group automatically.
I try send email to [email protected] with subject & body "subscribe" by PHP Mail function from user email. but not any result and subscription resquest in my group.
$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('[email protected]');
$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();
}
Can any one help me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在查看 hMailServer 中的 问题时论坛。
那里的人给出了一些关于如何做到这一点的想法(尽管没有代码),但有很好的考虑。
但除了让用户订阅列表之外,还有更多的事情要做。您还需要验证用户提供的电子邮件地址,以便人们不会输入其他人的电子邮件地址。这可以通过向用户发送电子邮件并要求他确认订阅来完成。当他单击链接进行确认时,他会转到您的网页,该网页与某个数据库条目相关,然后电子邮件将以您尝试的方式添加到列表中。
但请查看我上面提供的链接以了解更多注意事项。
这是另一个类似的帖子< /a>.
至于代码,这里有一个片段。
此线程也有一些 php 代码,与您的类似 - 您应该看看这个。
Whilst looking at a question in the hMailServer forum.
The fellow there gives some ideas on how to do this (albeit, no code), but there are good considerations.
But there is a bit more involved than just subscribing the user to the list. You also need to validate the email address the user provides so that people don't enter other people's email addresses. This would be done by sending an email to the user and asking him to confirm his subscription. When he clicks the link to confirm, he goes to your webpage that is keyed to a database entry somewhere, and then the email gets added to the list in a manner that you are attempting.
But check out the link I provide above for a few more considerations.
Here is another similar thread.
As for code, there is a snippet here.
This thread also has some php code, similar to yours - you should look at this.