Laravel 8 遍歷收件人列表

2021-07-19 10:48 更新

有時,你需要通過遍歷一個收件人 / 郵件地址數(shù)組的方式,給一系列收件人發(fā)送郵件。因為 to 方法會給 mailable 列表中的收件人追加郵件地址,你應(yīng)該為每個收件人重建 mailable 實例。

foreach (['taylor@example.com', 'dries@example.com'] as $recipient) {
    Mail::to($recipient)->send(new OrderShipped($order));
} 
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號