-3
在我的網站上與PHPmailer掙扎之後,我還沒有找到解決方案。首先,我從我的require()函數接收致命錯誤,但將路徑更改爲相對並且工作正常。接下來,第7行的語法錯誤。我不完全確定爲什麼我收到錯誤,任何人都可以幫忙嗎?解析錯誤:語法錯誤,意外T_VARIABLE PHP郵件程序
<?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';
}
?>
感謝您的輸入。現在我回到我的原始錯誤: 致命錯誤:require()[function.require]:無法打開所需'PHPMailer/PHPMailerAutoload.php'(include_path ='。:/ usr/lib/php:/ usr/local/lib/php')在/home/a3785759/public_html/PHPMailer/test1.php在線4 – JLTheCapo
@JLTheCapo你把「PHPMailerAutoload.php」文件放在哪裏? – melpomene
我把PHPMailerAutoload.php文件放在public_html目錄下的PHPMailer目錄中。 – JLTheCapo