Eliana
Eliana

Reputation: 425

Laravel: Mail send not working

If i do this in Laravel 5.1

Route::get('test_email', function(){
  Mail::raw(
        "",
        function ($mail) {
            $mail->from('[email protected]');
            $mail->to('[email protected]', 'test');
         }
   );
});

The email is sent to MAIL_TO_ADDRESS set into .env. It ignore the to value. Why?

Upvotes: 0

Views: 587

Answers (2)

Someshwer Bandapally
Someshwer Bandapally

Reputation: 149

\Mail::send('view_name', [array of parameters for sending them to view file], function($mail) { $mail->to('[email protected]', 'full_name')->from('[email protected]')->subject('Mail'); });

You have to use "log" as MAIL_DRIVER.

You can set the above mail configuration in config/mail.php

Mail will be logged to the log file you can open log file at storage/logs and you can see the mail in it.

Upvotes: 0

Kashish Agarwal
Kashish Agarwal

Reputation: 333

Please try this:

Mail::send('', array(), function($mail) {
  $mail->to('[email protected]', 'full_name')->from('[email protected]')->subject('Mail');
});

Upvotes: 1

Related Questions