我刚将我的网站上传到实时服务器,它不再发送电子邮件,网络主机希望我使用PHPMAILER。问题是我的代码在过程接口中,PHPMAILER在OOP中。请帮我把OOP改为程序。
$to = $email; // Send email to our user
$subject = 'Signup | Verification'; // Give the email a subject
$message = '
Thanks for signing up!
Your account has been created, you can login with the following credentials after you have activated your account by copying the url below
and pasting it in your brwoser.
------------------------
Username: '.$email.'
Password: '.$pass.'
------------------------
Please copy and paste this link in the address field and press enter to activate your account:<br>
http://elam.rpaz.co.zw/verify.php?email='.$email.'&password='.$cryptpass.'
'; // Our message above including the link
$headers = 'From:noreply@rpaz.co.zw' . "\r\n";
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "mail-2.sslzol.co.zw";
$mail->Port = 6465;
$mail->Username = 'noreply@jyvukyv';
$mail->Password = 'rp15kuyuelamhvkyu';
$mail->Subject = trim("Signup | Verification");
$mail->SetFrom('noreply@rpaz.co.zw', 'RPAZ e(LAM)');
$mail->AddAddress($email);
$mail->MsgHTML($message);
try {
$mail->send();
} catch (Exception $ex) {
echo $msg = $ex->getMessage();
}
echo "1 record added";
mysqli_close($conn);
header("Location: redirect.html");
exit;
}
&#13;
答案 0 :(得分:0)
include 'RouteToPHPMailer/PHPMailer';
$mail = new PHPMailer();
并且所有代码都已粘贴并且可以使用。