I am sending email similar to this: Laravel 5: Sending Email. This is how I do it:
$mail_status = Mail::send( 'emails.followup', $data, function( $message ) use ($data) {
$message->to( $data['email'] )
->from( $data['email_from'], $data['email_name'] )
->subject( $data['subject'] );
});
if($mail_status) {
$ret_status = 'sent';
}
else
$ret_status = 'sent_failed';
Now, if the $ret_status
is 'sent_failed', I want to know what happened. How do I do it? How can I see the message from the mail server?
Here is my .env
file:
MAIL_DRIVER=smtp
MAIL_HOST=mail.mydomain.com
MAIL_PORT=465
MAIL_USERNAME=noreply@mydomain.com
MAIL_PASSWORD=thepassword
MAIL_ENCRYPTION=ssl
Update
Looks like the approach above is Laravel 4. If you know how to get the error code using Laravel 5+, I can consider it as the correct answer.