2016-05-08 7 views
0

PHP Mailerの私のコードを実行する際に上記のエラーが発生しました。私は理由を理解することはできません。 PHPのバージョンは5.2です。私の無料ウェブサイト000webhost.comをホストしています。PHP Mailer is_a():推奨されていません。 instanceof演算子を使用してください

エラースクリーンショットが表示されます。

error

require 'PHPMailer-master/PHPMailerAutoload.php'; 

date_default_timezone_set('Asia/Colombo'); //this function sets the default timezone used by all data/time functions in the script 
              //Solution for the error - It is not safe to rely on the system's timezone settings. 
ini_set ('max_execution_time', 1200); //Solution for the error - set_time_limit() has been disabled for security reasons 

$mail = new PHPMailer; 

//$mail->SMTPDebug = 3;        // Enable verbose debug output 

$mail->isSMTP();          // Set mailer to use SMTP 
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers 
$mail->SMTPAuth = true;        // Enable SMTP authentication 
$mail->Username = '[email protected]';     // SMTP username 
$mail->Password = 'testemail123';       // SMTP password 
$mail->SMTPSecure = 'ssl';       // Enable TLS encryption, `ssl` also accepted 
$mail->Port = 465;         // TCP port to connect to 

$mail->setFrom('[email protected]', 'Raveen Chandra'); 
$mail->addAddress('[email protected]', 'Chairman');  // Add a recipient 
//$mail->addAddress('[email protected]');    // Name is optional 
//$mail->addReplyTo('[email protected]', 'Information'); 
//$mail->addCC('[email protected]'); 
//$mail->addBCC('[email protected]'); 

$mail->addAttachment('uploads/3.JPG');   // Add attachments 
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name 
$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'; 

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

おそらくあなたは、そのライブラリの新しいバージョンが必要ですか? –

+0

最新のサーバで別のホストを試してください –

+0

あなたのphp mailerクラスを更新してください –

答えて

0
/* 
public function smtpClose() 
    { 
     //if (is_a($this->smtp, 'SMTP')) { 
     $o = 'SMTP'; 
     if($this->smtp instanceof $o) { 
      if ($this->smtp->connected()) { 
       $this->smtp->quit(); 
       $this->smtp->close(); 
      } 
     } 
    } 
*/ 
+0

説明を追加してください。それは答えを理解し、あなたがdownvotesを取得しないようにするのに役立ちます。 – Ash

+0

あなたのコードは何をすべきですか?なぜそれが '/ *'で完全に '* /'とコメントしていますか? – Pang

関連する問題