PHPMailer install without Composer

后端 未结 5 1507
旧巷少年郎
旧巷少年郎 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:00

    In version 6.02, each of the phpmailer modules contain the namespace PHPMailer\PHPMailer declaration so the following works (no autoloader needed but this routine should be in /src folder):

    include($_SERVER['DOCUMENT_ROOT'].'/path_setup.php');
    require_once ($_SERVER['DOCUMENT_ROOT'].'/php/PHPMailer/src/PHPMailer.php');
    require_once ($_SERVER['DOCUMENT_ROOT'].'/php/PHPMailer/src/SMTP.php');
    require_once ($_SERVER['DOCUMENT_ROOT'].'/php/PHPMailer/src/Exception.php');
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\SMTP;
    use PHPMailer\PHPMailer\Exception;
    $mail = new PHPMailer(true);
    

提交回复
热议问题