Tuesday, March 7, 2017

Change FROM and REPLYTO address in Laravel 5.4

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('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()

I tried full of possibility, but I can not change the field FROM and REPLYTO Can you help me ? Thank's



via Boss COTIGA

Advertisement