tp 利用 phpmailer 傳送郵件

2021-08-17 16:59:57 字數 430 閱讀 2201

準備前提:

1、開啟openssl擴充套件   (php.ini或者整合環境直接開啟)

composer require phpmailer/phpmailer

**:

public function test()

else

}/**

* 傳送郵件方法

* @param string $title:郵件的標題

* @param string $content:郵件內容

* @return boolean true:傳送成功 false:傳送失敗

*/function sendmail($to,$title,$content)else

}

今天測試$mail->helo一直報錯,然後注釋掉了。。。

TP5使用PHPMailer傳送郵件

網上好多答案都過時了,這裡重新記一下 一 使用composer安裝phpmailer notes 傳送郵件 param string tomail 接收郵件者郵箱 param string name 接收郵件者名稱 param string subject 郵件主題 param string bod...

利用PHPMailer傳送郵件時報錯

利用thinkphp整合phpmailer傳送郵件時報錯 failed to connect to server unable to find the socket transport ssl did you forget to enable it when you configured php 解...

使用PHP利用phpmailer傳送電子郵件

2.使用composer 安裝 composer require phpmailer phpmailer 傳送之前需要擁有自己的郵件伺服器,測試的時候其實用自己申請的免費郵箱最方便了,不需要自己再搭建伺服器了,可能要配置郵箱的smtp服務,大部分公共郵箱 163 qq等 為了安全預設是關閉的,下面給...