mercredi 17 février 2016

Laravel 5.1 Mail::send how to know why it don't sends mails?

I am trying Laravel do a mail send. When I execute the code, nothing happens, no errors, no logs, no returning mails, anything.

Config Env

MAIL_DRIVER=smtp
MAIL_HOST=mail.domain.es
MAIL_PORT=587
MAIL_USERNAME=noreply@domain.es
MAIL_PASSWORD=xxxxxx
MAIL_FROM=noreply@domain.es
MAIL_NAME=Domain Name
MAIL_ENCRYPTION=null

Mail.php

return [
    'driver' => 'smtp',
    'host' => env('MAIL_HOST', 'mail.domain.es'),
    'port' => env('MAIL_PORT', 587),
    'from' => ['address' => 'noreply@domain.es', 'name' => 'Domain Name'],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME', 'noreply@domain.es'),
    'password' => env('MAIL_PASSWORD', 'xxxxx'),
    'sendmail' => '/usr/sbin/sendmail -bs',
    'pretend' => env('MAIL_PRETEND', true),
];

Code in the controller

  $accion = Accion::findOrFail($id);
  Mail::send('emails.notificar', ['accion' => $accion], function ($m) use ($accion) {
      $m->from(env('MAIL_FROM'), env('MAIL_NAME'));
      $m->to("jtd@adagal.es", "Jtd")->subject('Nova acción formativa');
  });

Did you see any error? I did everything that is marked in the official docs but still no response, no mail, no error.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire