vendredi 28 avril 2017

Adding replyTo in mail.php not working in Laravel 5.1

I have a laravel 5.1 app. I am sending emails in several places. When I add replyTo like below it works.

Mail::queue('emails.password_update', ['user' => $user, 'password' => $password], function($message) use ($user){
            $message->to($user->email, $user->name)->subject('Account Password Updated');
            $message->replyTo('noreply@divostar.com', 'DivoStar');
            $message->priority(1);
        });

But, given that emails are sent in several places and the replyTo email is same. I don't want to repeat it everywhere. What I have done is add an entry in mail.php like below:

'replyTo' => ['address' => 'noreply@divostar.com', 'name' => 'DivoStar'],

and send the mail as such:

 Mail::queue('emails.password_update', ['user' => $user, 'password' => $password], function($message) use ($user){
                $message->to($user->email, $user->name)->subject('Account Password Updated');
                $message->priority(1);
            });

When I do this, it doesn't work. There is no Reply-To in the mail. Why is the entry in mail.php not read?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire