GameHost綜合論壇
標題:
【Laravel 寄信教學】
[打印本頁]
作者:
admin
時間:
2016-12-24 22:31
標題:
【Laravel 寄信教學】
首先要設定 config/services.php
依照寄信的方式分別設定不同的參數
Mailgun
'mailgun' => [
'domain' => 'your-mailgun-domain',
'secret' => 'your-mailgun-key',
],
複製代碼
Mandrill
'mandrill' => [
'secret' => 'your-mandrill-key',
],
複製代碼
SparkPost Diver
'sparkpost' => [
'secret' => 'your-sparkpost-key',
],
複製代碼
SES Driver
'ses' => [
'key' => 'your-ses-key',
'secret' => 'your-ses-secret',
'region' => 'ses-region', // e.g. us-east-1
],
複製代碼
實際範例
[attach]141[/attach]
範例解釋
Mail::send() 有三個參數:
第一個參數是信件的模板,是以HTML語法為主的介面
[attach]140[/attach]
第二個參數是 data,就是模板內使用的資料,如上圖所示,$host參數被傳到模板使用了
[attach]141[/attach]
第三個參數是一個匿名函數,如果要使用變數就要用『 use 』將變數帶入匿名函數中
[attach]139[/attach]
歡迎光臨 GameHost綜合論壇 (http://www.gamehost.cc/bbs/)
Powered by Discuz! X3.2