i can't send email with user address as FROM and Reply To
In the FormRequest :
public function persist()
{
$reservation = Resa::create(
$this->only(['nom', 'email', 'phone', 'formule', 'date_arr', 'date_ret', 'nb_adu', 'nb_enf', 'lemessage'])
);
Mail::to('[email protected]')
->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()
I tried full of possibility, but I can not change the field FROM and REPLYTO Can you help me ? Thank's
The Mail
Facade does not implement the replyTo()
method anymore. Instead this method has moved to the Mailable
class itself. Official documentation proposes to use the build()
method to setup the Mailable, however this is not always convenient (eg the replyTo field might be different each time)
However if you still want to use a similar syntax you can use:
$mailable = new myMailableClass;
$mailable->replyTo('[email protected]');
Mail::to('email@tocom')
->send($mailable);
For a complete list of available methods on the Mailable class see the Mailable Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With