解析错误:语法错误,意外的T_VARIABLE PHP Mailer

时间:2016-07-16 23:07:14

标签: php phpmailer

在我的网站上与PHPmailer斗争后,我还没有找到解决方案。首先,我从require()函数接收到致命错误,但是将路径更改为relative并且工作正常。接下来,第7行语法错误。我不完全确定为什么我收到错误,有人可以帮忙吗?

<?php
$email = $_REQUEST['email'] ;

$message = $_REQUEST['message'] ;
require "PHPMailer/PHPMailerAutoload.php"

$mail = new PHPMailer();

$mail->IsSMTP();

$mail->Host = "localhost";

$mail->SMTPAuth = true;

$mail->Username = "(myemail)";  // SMTP username

$mail->Password = "(mypassword)"; // SMTP password

$mail->SMTPSecure = "tls";

$mail->Port = 587;

$mail->From = "(myemail)";

$mail->addAddress('anotheroneofmyemails'); 

// set word wrap to 50 characters
$mail->WordWrap = 50;

// set email format to HTML
$mail->IsHTML(true);

$mail->Subject = 'Customer Inquiry Information:';

$mail->Body = $message;

$mail->AltBody = $message;

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}
?>

1 个答案:

答案 0 :(得分:2)

您忘记了;行末尾的require