Laravel error about GMAIL smtp usage: "Unable to establish connection with host "mailpit:1025""
P粉283559033
P粉283559033 2023-08-24 23:32:49
0
1
372
<p>I tried sending email using Laravel and Gmail but it throws this error: </p> <blockquote> <p>Unable to establish connection to host 'mailpit:1025': Stream_socket_client(): php_network_getaddresses: Get address information Mailpit failed: No such host is known. </p> </blockquote> <p>I don't understand why it's trying to connect to Mailpit instead of Gmail. </p> <p>My .env file looks like this: </p> <pre class="brush:php;toolbar:false;">MAIL_MAILER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=est.juan.arango1@unimilitar.edu.co MAIL_PASSWORD=[google app password] MAIL_ENCRYPTION=ssl</pre> <p>My routing looks like this: </p> <pre class="brush:php;toolbar:false;">Route::get('/senMail', function () { try { Mail::to('est.juan.arango1@unimilitar.edu.co'')->send(new Subscribe()); } catch (Throwable $e) { return '<div>FAILED ' . $e . '</div>'; } });</pre> <p>The subscription template is regular<code>php artisan make:mail Subscribe --markdown=emails.subscribers</code></p> <p>I tried running <code>php artisan cache:clear </code> and <code>php artisan config:clear</code> but it kept throwing errors, I also changed the port 587 to 465, But no success. < /p> <p>Also tried this configuration in the <code>config/mail.php</code> file: </p> <pre class="brush:php;toolbar:false;">'stream' => [ 'ssl' => [ 'allow_self_signed' => true, 'verify_peer' => false, 'verify_peer_name' => false, ], ],</pre></p>
P粉283559033
P粉283559033

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!