PHPMailer install without Composer

后端 未结 5 1504
旧巷少年郎
旧巷少年郎 2021-01-13 15:03

Please forgive my ignorance. I am trying to install PHPMailer 6.0.1 under PHP 5.6 on Linux. My PHP installation is remote and I manage all my websites’ PHP via FTP (I typi

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-13 16:02

    First create a folder src and create Exception.php,PHPMailer.php,SMTP.php Liber's then we get results

    isSMTP(); 
    $mail->SMTPDebug = 2; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
    $mail->Host = "smtp.gmail.com"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
    $mail->Port = 587; // TLS only
    $mail->SMTPSecure = 'tls'; // ssl is depracated
    $mail->SMTPAuth = true;
    $mail->Username = '@gmail.com';
    $mail->Password = '';
    $mail->setFrom('@gmail.com', '...');
    $mail->addReplyTo('@gmail.com', ' Name');
    $mail->addAddress('@gmail.com', '...');
    $mail->Subject = 'PHPMailer GMail SMTP test';
    $mail->msgHTML("Hello test SMTP body"); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded,
    $mail->AltBody = 'HTML messaging not supported';
    // $mail->addAttachment('images/phpmailer_mini.png'); //Attach an image file
    
    if(!$mail->send()){
        echo "Mailer Error: " . $mail->ErrorInfo;
    }else{
        echo "Message sent!";
    }
    ?>*strong text*
    

提交回复
热议问题