am trying to send email from my laravel app after a user registers but it keeps giving me this error in the network tab,
"message": "Connection could not be established with host mail.i-scbank.com [ #0]
The app is hosted in a shared hosting(cpanel)
i tried with mailtrap and it worked, but when i tried it with my mail server, i got that error message, i even created a new email account, but it still did not work,
Here is my .env code
MAIL_DRIVER=smtp
MAIL_HOST=mail.eloike.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=*****
[email protected]
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME="Stones"
here is my config/mail.php code
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
pls what am i doing wrong and how can i make the email to be sending
3
Answers
you must change
mail.eloike.com
withstmp.eloike.com
Port is probably blocked by a firewall, or access is restricted.
You can perform a port mapping in order to check:
filtered means that nmap doesn’t really know what is the port status because something is filtering traffic.
You can also try connecting with openssl as client:
I had this output:
That means connection refused.
For more information, you have to contact your provider, or to change mailer!
SMTP port 587 is a STARTTLS port, not TLS. This means that:
Trying to establish an encrypted connection immediately will fail, e.g.:
Trying to establish an unencrypted connection upgraded with STARTTLS will succeed, e.g.:
You’ll need to read up on cPanel to see if it can support outgoing STARTTLS connections (I know it can support incoming connections).