我正在尝试使用Laravel Mailable 给所有客户发送邮件,我的邮件结构如下。
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
/**
* Class BroadcastEmail
* @package App\Mail
*/
class BroadcastEmail extends Mailable
{
use Queueable, SerializesModels;
/**
* @var
*/
private $title;
/**
* @var
*/
private $body;
/**
* Create a new message instance.
*
* @param $title
* @param $body
* @return void
*/
public function __construct($title, $body)
{
$this->title = $title;
$this->body = $body;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->subject($this->title)->view('emails.broadcast')->with(['body' => $this->body]);
}
}
我已使用以下代码发送电子邮件。
Mail::to($recipients)->send(new BroadcastEmail($title, $message));
这里的
$recipients
变量是客户邮件的数组,未来其大小可能超过10,000。Mail Facede可以处理发送电子邮件的$recipients
数组的最大大小是多少?我已经阅读了Laravel邮件文档,但仍然无法弄清楚。欢迎任何建议和帮助。
implements ShouldQueue
吗?此外,你也可以向一组用户发送电子邮件。 - Prafulla Kumar Sahu