所以我有这段代码。 这是一个网站,当管理员批准你是一个用户,他点击此链接。它将设置帐户激活,但我也想发送电子邮件。确认电子邮件不发送
<?php
error_reporting(-1);
ini_set('display_errors', 'On');
require('includes/config.php');
//collect values from the url
$memberID = trim($_GET['x']);
$active = trim($_GET['y']);
//if id is number and the active token is not empty carry on
if(is_numeric($memberID) && !empty($active)){
//update users record set the active column to Yes where the memberID and active value match the ones provided in the array
$stmt = $db->prepare("UPDATE members SET active = 'Yes' WHERE memberID = :memberID AND active = :active");
$stmt->execute(array(
':memberID' => $memberID,
':active' => $active,
));
//if the row was updated redirect the user
if($stmt->rowCount() == 1){
//redirect to login page
$stmt = $db->prepare("SELECT email FROM members WHERE memberID = :memberID");
$stmt->bindparam(':memberID', $memberID);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_OBJ);
//send email
$to = $result->email;
$subject = "account actief";
$body = "Uw account op http://www.nol-groningen.nl is actief \n\n
Met Vriendelijke groet,\n\n
Website Admin";
$additionalheaders = "From: <".SITEEMAIL.">\r\n";
$additionalheaders .= "Reply-To: $".SITEEMAIL."";
mail($to, $subject, $body, $additionalheaders);
header('Location: login.php?action=active');
exit;
} else {
echo "Your account could not be activated.";
}
}
?>
它在我把电子邮件放进去之前做了工作,现在它只是进入一个空白页面。有谁知道我可以修复它,让它发送确认电子邮件?
看起来像一个黑名单事 – roullie 2014-12-04 10:19:48
尝试回声$电子邮件;检查天气有一些邮件或不在变量中。 – 2014-12-04 10:23:47