我无法使用用户地址作为FROM和Reply To发送电子邮件。
在FormRequest中:
public function persist()
{
$reservation = Resa::create(
$this->only(['nom', 'email', 'phone', 'formule', 'date_arr', 'date_ret', 'nb_adu', 'nb_enf', 'lemessage'])
);
Mail::to('contact@cotiga.fr')
->from($reservation->email, $reservation->nom)
->replyTo($reservation->email, $reservation->nom)
->send(new Reservation($reservation));
}
I have the error :
FatalThrowableError in ReservationForm.php line 48:
Call to undefined method Illuminate\Mail\PendingMail::from()
我尝试了很多可能性,但是我无法更改“FROM”和“REPLYTO”字段。你能帮我吗? 谢谢
build
方法内设置replyTo
,subject
等时,您将无法测试这些值是否已设置(模拟电子邮件上从未调用build
方法)。最好将其移至构造函数。 - Amade