phyuphyuthaw's avatar

Expected response code 220 but got an empty response

I am trying to send email from Laravel. My settings of .env file is as below.

MAIL_DRIVER=sendmail MAIL_HOST=localhost MAIL_PORT=465 MAIL_USERNAME=/cpanel webmail created/ MAIL_PASSWORD=password MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS=[email protected] MAIL_FROM_NAME="[email protected]" MAIL_TIMEOUT=600 MAIL_DEBUG=true

My current function I am going call the route is as follow. public function emailTest() { $receiver_email = "[email protected]"; $greeting = "HELLO. This is mail test from email server"; Mail::to($receiver_email)->send(new TestMail($greeting)); }

//Test Mail.php

0 likes
4 replies
Tray2's avatar

Of course you get an empty response, you don't return anything.

You probably should redirect with a status code, or at least send some response back.

Snapey's avatar

try mail driver smtp

what does your host say about sending email?

phyuphyuthaw's avatar

@Snapey

Thank you for your advice. It works well with this setting for now.

MAIL_DRIVER=smtp MAIL_HOST=localhost MAIL_PORT=25

I am sure I have been trying this pair of settings, but it didn't work the whole day. But it turns out working somehow by now.

Please or to participate in this conversation.