I'm trying to test some emails within a laravel 4.2 app and have configured mail.php to use mailtrap
here's my mail.php config:
return array(
'driver' => 'smtp',
'host' => 'smtp.mailtrap.io',
'port' => 2525,
'from' => array('address' => 'website@domain.co.uk', 'name'=>'Domain'),
'encryption' => 'null',
'username' => '12345XX',
'password' => '12345XX',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
);
I'm trying to use this within a development environment with a vagrant box (homestead)
I'm using a basic test script as follows to send a test email:
$data = array(
'activationCode' => '123456789',
'id' => 27,
'user' => [
'id'=>27,
'first_name'=>'TEST USER',
'last_name'=>'LAST NAME',
'email'=>'test@domain.org.uk'
]
);
$firstResult = Mail::send('emails.auth.accessPending', $data, function ($message) {
$message
->to('email@domain.com')
->subject('website registration');
});
I get a NULL
response and nothing appears in the mailtrap inbox.
What am I missing in either my configuration or script to get the app to send test emails?
Thanks
Can you check if you have .env file those
MAIL_HOST=mailtrap.io
_PORT=2525
MAIL_USERNAME=your username
MAIL_PASSWORD=your pass
MAIL_ENCRYPTION=null
Ok - it was working - sort of. The reason there was no output because the mail config file for local development was set to pretend
Revealed by a quick check of the log file
Ta
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.