我正在尝试发送电子邮件确认注册。我已经创建了
app>Mailers>AppMailer
。
class AppMailer {
protected $mailer;
protected $from = '[email protected]';
protected $to;
protected $view;
protected $data = [];
public function __construct(Mailer $mailer)
{
$this->$mailer = $mailer; // Line 23
}
但是,我收到错误:
AppMailer.php 第 23 行中的ErrorException:
类 Illuminate\Mail\Mailer 的对象无法转换为字符串
设置
$this->mailer
,而不是 $this->$mailer
。
所以代替这个:
$this->$mailer = $mailer;
// ^
使用这个:
$this->mailer = $mailer;
return $this->subject('Your Password Expires Soon')->$this->view('Email.Password-Policy.PasswordPolicyMail');
更改为
return $this->subject('Your Password Expires Soon')->view('Email.Password-Policy.PasswordPolicyMail');