PHP Mailer没有';好像不行

PHP Mailer没有';好像不行,php,phpmailer,Php,Phpmailer,我正在一个网站的注册页面上工作,在那里我需要实施电子邮件验证 我已在服务器上安装了PHPMailer master。代码的第一部分直接在注册php中编写: include('send_mail.php'); $to=$email; $subject="Email verification"; $body='Hi, <br/> <br/> thank you for joining us! Please verify your email and g

我正在一个网站的注册页面上工作,在那里我需要实施电子邮件验证

我已在服务器上安装了PHPMailer master。代码的第一部分直接在注册php中编写:

include('send_mail.php');
    $to=$email;
    $subject="Email verification";
    $body='Hi, <br/> <br/> thank you for joining us! Please verify your email and get started using your account. <br/> <br/> <a href="'.$base_url.'activation/'.$activation.'">'.$base_url.'activation/'.$activation.'</a>';

    Send_Mail($to,$subject,$body);
    $msg= "Registration successful, a verification email has ben sent to you. Please activate this to get started."; 
include('send_mail.php');
$to=$email;
$subject=“电子邮件验证”;
$body='嗨,

谢谢您的加入!请验证您的电子邮件并开始使用您的帐户

; 发送邮件($to,$subject,$body); $msg=“注册成功,已向您发送验证电子邮件。请激活此电子邮件以开始。”;
以及send_mail.php中的代码:

<?php
function Send_Mail($to,$subject,$body)
{
require 'PHPMailer-master/class.phpmailer.php';
require 'PHPMailer-master/PHPMailerAutoload.php';
$from       = "*mywebsite*";
$mail       = new PHPMailer();
$mail->IsSMTP(true);            // use SMTP
$mail->IsHTML(true);
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "*my webhost's mailserver*"; // SMTP host
$mail->Port       =  465;                    // set the SMTP port
$mail->Username   = "*username*";  // SMTP  username
$mail->Password   = "*password*";  // SMTP password
$mail->SetFrom($from, '*mywebsite?*');
$mail->AddReplyTo($from,'*mywebsite?*');
$mail->Subject    = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, $to);
$mail->Send(); 
}
?>

有一个内置的PHP邮件函数,可能更容易:如果您得到一个空白页面,那么脚本中就出了问题。我建议您开始查看记录php错误的http服务器错误日志文件。如果您可以查看该文件并读取错误的实际内容,那么尝试猜测问题可能是什么毫无意义$邮件->添加地址($address,$to)?指定同一地址两次?白色屏幕通常表示PHP错误,如果在PHP.ini中启用错误显示,您将在web服务器日志或屏幕上看到该错误。我建议您阅读PHPMailer文档,开始使用与PHPMailer捆绑的示例之一,因为您的代码基于一个过时的示例。如果你不知道自己在做什么,那么使用mail()是一个非常糟糕的主意。我已经更新了这个问题。
        $email = $_POST['email'];
require 'PHPMailer-master/PHPMailerAutoload.php';   
$mail = new PHPMailer(true);
try {
$mail->AddReplyTo('myemail');
$mail->AddAddress($email);
$mail->SetFrom('myemail');
$mail->AddReplyTo('myemail');
$mail->Subject = 'subject';
$mail->Message = 'message comes here';
$mail->Send();
echo "Message Sent OK<p></p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage();
} catch (Exception $e) {
echo $e->getMessage();
}