john john - 23 days ago 7
PHP Question

laravel 5.2 mail not working

I have laravel 5.2 with mamp pro in my mac. I work localhost, and i try to send email to mailtrap but is not work i have this error

Maximum function nesting level of '100' reached, aborting!


my .env

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=MyuserName
MAIL_PASSWORD=MyPassword
MAIL_ENCRYPTION=null


in my controller

Mail::send('emails.test', ['user' => 'test'], function ($m) {
$m->from('from@example.com', 'Your Application');

$m->to('from@example.com')->subject('Your Reminder!');
});

Answer

Try by adding the following code in bootstrap/autoload.php file. It increases the xdebug.max_nesting_level to 200.

ini_set('xdebug.max_nesting_level', 200);

If this doesn't solve then try to increase the level by 300 or 400.