tp5.0发送邮件
1.从https://github.com/PHPMailer/PHPMailer网址下载PHPMailer类,将图片中的文件放到tp5.0里面的extend文件里面的PHPMailer里面的PHPMailer 2.在Index模板中的Index控制器中写下面的方法 < ? php namespace app\index\controller ; //引用相关的文件 use PHPMailer\PHPMailer\Exception ; use PHPMailer\PHPMailer\PHPMailer ; use PHPMailer\PHPMailer\ SMTP ; class Index { public function mail ( ) { $toemail = '3243280881@qq.com' ; //定义收件人的邮箱 $mail = new PHPMailer ( ) ; $mail - > isSMTP ( ) ; // 使用SMTP服务 $mail - > CharSet = "utf8" ; // 编码格式为utf8,不设置编码的话,中文会出现乱码 $mail - > Host = "smtp.qq.com" ; // 发送方的SMTP服务器地址 $mail - > SMTPAuth = true ; // 是否使用身份验证 $mail - >