2016-05-08 8 views
0

Ich habe den obigen Fehler bei der Ausführung meines Codes von PHP Mailer erhalten. Ich kann den Grund nicht herausfinden. PHP-Version ist 5.2. in meinem kostenlosen Webhosting-Server 000webhost.com.PHP Mailer is_a(): Veraltet. Bitte benutzen Sie den instanceof -Operator

Fehler Screenshot ist dort gezeigt;

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

vielleicht müssen Sie eine neue Version der Bibliothek? –

+0

Versuchen Sie einen anderen Host mit einem aktuelleren Server –

+0

aktualisieren Sie Ihre PHP-Mailer-Klasse –

Antwort

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

Bitte eine Beschreibung hinzufügen. Es hilft Ihnen, die Antwort zu verstehen und sicherzustellen, dass Sie keine Downvotes bekommen. – Ash

+0

Was soll dein Code tun? Warum ist es vollständig in '/ *' Kommentare '* /'? – Pang

Verwandte Themen