phpsimplemail
2.0
<?php$e = new Mailer;$setup = ['主機' => '', '使用者名稱'=>'', '密碼'=>'', '驗證'=>'', '連接埠' => '' ];$e->init('smtp') ->設定($設定) ->主題('歡迎') ->to(['name' => 'David Inyang', 'email'=>'[email protected]']) ->from(['name' => 'David Inyang', 'email'=>'[email protected]']) ->body('嗨,歡迎加入團隊') ->sendmail();
這是一個簡單的郵件介面,讓發送 smtp 電子郵件變得極為容易。
您可以傳送純文字或 HTML 電子郵件,也可以透過流暢的介面輕鬆新增附件。
它提供了製作幾乎任何類型的電子郵件所需的所有基本部分。
主機 = smtp 主機 URL
使用者名稱 = smtp 用戶名
密碼=smtp密碼
身份驗證 = SSL 或 TLS
端口 = smtp 端口
apiKey = 您的 sendgrid api 金鑰
要使用 Composer 進行安裝,只需需要該軟體包的最新版本即可。
作曲家需要 thedavidinyang/phpsimplemail
確保 Composer 中的自動載入檔案已載入。
// 在專案載入初期,需要 Composer 自動載入器 // 請參閱:http://getcomposer.org/doc/00-intro.mdrequire 'vendor/autoload.php';
下載打包的存檔並將其解壓縮到包所在的目錄中
您可以從 https://github.com/thedavidinyang/phpsimplemail/releases 下載 dompdf 的穩定副本
只需將您的電子郵件配置傳遞到 PHPSimplemail 即可:
// 引用SimpleMail 命名空間use thedavidinyangSimpleMailMailer;// 設定SMTP 設定$setup = ['host' => '', 'username'=>'', 'password'=>'', 'authentication'=>'', ' port'=>'' ];// 初始化並使用 SimpleMail 類別$e = new Mailer;$e->init('smtp') ->setup($setup)// 設定郵件參數// 主題->主題('歡迎')// 收件者->to(['name' => 'David Inyang', 'email'=>'samplemail @gmail .com'])// Sender->from(['name' => 'David Inyang', 'email'=>'[email protected]'])// Content->body('您好,歡迎來到team')//發送郵件->sendmail();
只需將您的 sendgrid API 金鑰傳遞到 PHPSimplemail 即可:
// 引用 SimpleMail 命名空間use thedavidinyangSimpleMailMailer;// 設定 SMTP 設定$setup = ['apiKey' => '' ];// 初始化並使用 SimpleMail 類別$e = new Mailer;$e->init('sendgrid') ->setup($setup)// 設定郵件參數// 主題->主題('歡迎')// 收件者->to(['name' => 'David Inyang', 'email'=>'samplemail @gmail .com'])// Sender->from(['name' => 'David Inyang', 'email'=>'[email protected]'])// Content->body('您好,歡迎來到team')//發送郵件->sendmail();