PHPMailer 是PHP的经典电子邮件发送库。
composer require phpmailer/phpmailer
<?php
namespace app\index\controller;
use \PHPMailer\PHPMailer\PHPMailer;
use \PHPMailer\PHPMailer\Exception;
class Index
{
public function setmail()
{
# code...
$mail = new PHPMailer(true);
...
}
}