Error sending email in Laravel 5.7 - Swift_TransportException

0

Hello,

I am trying to send an email using Laravel 5.7, and I had some problems.

I wrote a view for my email. I then send the email rendered by the Controller, as follows:

Mail::send('admin.eventos.pessoa', ['pessoa' => $pessoa], function ($message) use ($pessoa){
   $message->to($pessoa->email);
});

I configured my email in Laravel as follows, the way I always do in test applications:

MAIL_DRIVER=smtp
MAIL_HOST=mx1.hostinger.com.br
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=senha
MAIL_ENCRYPTION=tls

In addition, I configured the mail.php file, to resolve the previous error "stream_socket_enable_crypto (): SSL operation failed with code 1. OpenSSL Error messages:      * error: 1416F086: SSL routines: tls_process_server_certificate: certificate verify failed ", as described in this English OS issue .

'stream' => [
    'ssl' => [
        'allow_self_signed' => true,
        'verify_peer' => false,
        'verify_peer_name' => false,
    ],
],

Well, then I call the controller method that calls that first excerpt that I put in the question. This controller is called via Post. But instead of the email being sent, I get this in response:

Swift_TransportException thrown with message "Expected response code 354 but got code" 554, with message "554 5.5.1 Error: no valid recipients ""

What can this be?

What I've already tried:

  • Install the guzzle library;
  • Switch TLS encryption to SSL;
  • Check server connection.
  • They all did not work out.

    I appreciate the answers.

        
    asked by anonymous 26.10.2018 / 22:59

    1 answer

    0

    I've already caught up a lot to set up this type of connection and I came to the following conclusion.

    Create and use Google accounts to send email, this is because some email servers do not accept this type of sending.

    Remembering that using an email Gmail has to release to use less secure applications

    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=587
    [email protected]
    MAIL_PASSWORD=suasenha
    MAIL_ENCRYPTION=tls
    
        
    29.10.2018 / 14:58