我已将phpmailer文件夹放入我的web主机帐户的public_html文件夹中,但是一旦我测试代码我没有收到任何错误消息,我得到的就是这条消息。
webpage.com页面无法正常工作
webpage.com目前无法处理此请求。
HTTP ERROR 500
这是我的代码
<?php
require_once("/home/webfolder/public_html/PHPMailer_5.2.0/class.phpmailer.php");
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->Host = "mail.example.com";
$mail->SMTPAuth = true;
$mail->Username = "test@example.com";
$mail->Password ="password";
$mail->From =("sender@mailer.com");
$mail->FromName = "John Smith";
$mail->AddAddress="test@example.com";
$mail->WordWrap="50";
$mail->IsHTML(true);
$mail->SMTPDebug = 1;
$mail->Port = 26;
$mail->SMTPSecure = "ssl";
$mail->Subject = "Helloworld of SMTP";
$mail->Body = "This is the first email sent from PHP";
$mail->AltBody = "this is alternative mail";
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo "Message has been sent";
}
?>
我已将此代码放在phpmailer文件夹外的名为testmailer.php的文件中,所以我通常会在这样的路径中测试代码
http://domain.com/testmailer.php