好的我在我的网站上注册了通过电子邮件激活帐户的激活帐户,我注意到并非所有成员都激活了他们的帐户,所以如果帐户是自动发送给他们的帐户7天内未激活从我希望每天一次运行该代码注册如何发送自动电子邮件给没有激活帐户的成员
的时间,但如果它被送到一个用户,然后下次就不会再发送电子邮件到同一个用户避免垃圾邮件
这里我到目前为止写了什么,但我不知道如何实现其余的
$query = "SELECT * FROM members WHERE active !='Yes' AND (joined > DATE_SUB(NOW(), INTERVAL 7 DAY))";
$stmt->execute();
$result = $stmt->fetch();
foreach ($result as $row) {
$id = $row['member_id'];
$to = $row['email'];
$activation = $row['active'];
$subject = "Account Activation";
$body = "<p><img src='".DIR."images/logo.png' alt='logo'></p> <p>Hello,</p><p>Thank you for registering at ".SITEURL.".</p>
<p>It seems you have still not activated you account, to activate your account, please click on this link: <a href='".DIR."activate.php?x=$id&y=$activation'>CLICK HERE</a>. If you do not activate your account within 7 days your account will automatically get deleted. </p>
<p>Regards,<br/>".SITEURL."<br/><a href='tel:".SITEMOBILE."'>".SITEMOBILE."</a></p>
<p align='center'><small><font color='red'>This is an automated message, please do not reply to this.</font></small></p>";
$mail = new Mail();
$mail->setFrom(REGEMAIL);
$mail->addAddress($to);
$mail->subject($subject);
$mail->body($body);
$mail->send();
}
您的时间和帮助非常感谢
这似乎是一个cronjob – rbr94
也为根据自己尊敬的ID和激活散怎么做,发送电子邮件给用户的查询问题? –
E.g.在你的数据库中创建一个表,你在哪里登录电子邮件发送 – rbr94