2017-11-29 1 views
-1

PHPMailerのZIPファイルをダウンロードしてホストサーバーに保存し、PHPMailerファイルをインストール/解凍しました。 新規インストール後にPHPMailerを使用するとエラーが発生する

Parse error: syntax error, unexpected '[' in D:\InetPub\vhosts\ ******.com\ *********.com\language\PHPMailer\src\PHPMailer.php on line 288

はこれがダウンロードされたPHPMailer.phpファイルにエラーがあることを意味するものではありません。私はPHPMailer.phpファイルを使用する必要がステートメントを追加すると、私は次のエラーメッセージが表示されましたか?はいの場合は、その場所で使用できる修正されたファイルがありますか?

<?php 

ini_set('include_path','D:\inetpub\vhosts\******.com\*********.com\included_files;D:\inetpub\vhosts\******.com\*********.com\referenced_files;D:\inetpub\vhosts\******.com\*********.com\language;D:\inetpub\vhosts\******.com\*********.com\language\PHPMailer;D:\inetpub\vhosts\******.com\*********.com\language\PHPMailer\language;D:\inetpub\vhosts\******.com\*********.com\language\PHPMailer\src'); 

include("incPHP1.inc"); 

require 'Exception.php'; 
require 'PHPMailer.php'; 
require 'SMTP.php'; 

$mail = new PHPMailer(true);        // Passing `true` enables exceptions 
try { 
    //Server settings 
    $mail->SMTPDebug = 2;         // Enable verbose debug output 
    $mail->isSMTP();          // Set mailer to use SMTP 
    $mail->Host = $mailHost; // Specify main and backup SMTP servers 
    $mail->SMTPAuth = true;        // Enable SMTP authentication 
    $mail->Username = $mailUser;     // SMTP username 
    $mail->Password = $mailPassword;       // SMTP password 
    $mail->SMTPSecure = 'tls';       // Enable TLS encryption, `ssl` also accepted 
    $mail->Port = 587;         // TCP port to connect to 

    //Recipients 
    $mail->setFrom('*******@rlchealth.com', 'Mailer'); 
    $mail->addAddress('****@rlchealth.net', 'Joe User');  // Add a recipient 
    $mail->addAddress('*********@rlchealth.com');    // Name is optional 
    $mail->addReplyTo('********@rlchealth.com', 'Information'); 
    $mail->addCC('************@*****.com'); 
    $mail->addBCC('************r*****l.com'); 

    //Content 
    $mail->isHTML(true);         // Set email format to HTML 
    $mail->Subject = 'Here is the subject'; 
    $mail->Body = 'This is the HTML message body <b>in bold!</b>'; 
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; 

    $mail->send(); 
    echo 'Message has been sent'; 
} catch (Exception $e) { 
    echo 'Message could not be sent.'; 
    echo 'Mailer Error: ' . $mail->ErrorInfo; 
} 

?> 
+1

ウルPHPのバージョンは何ですか? 288号線には何がありますか? – Adam

+0

あなたの最初の質問に対する答えはPHPバージョン5.3.28です。 288行に現れるものは、GitHubからダウンロードしたサードパーティのソフトウェアです。私はここでそのコードを合法的に転載できるとは思わない。 – buckibooster

答えて

1

この問題は、お使いのPHPのバージョンである私は、uは、PHP 5.3を使用していると思うとphpMillerが5.6のためである:ここで私が実行しようとしていますPHPのコードです。

ur phpのバージョンを変更してから、もう一度お試しください。

+0

私は腕やアップグレードのために足を支払うことなく必要なPHPのバージョンを取得するホスティングサービスを変更しなければならなかったが、それは私がした後、すぐに作業を始めました。 – buckibooster

関連する問題