skip to Main Content

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


  1. you must change mail.eloike.com with stmp.eloike.com

    Login or Signup to reply.
  2. Port is probably blocked by a firewall, or access is restricted.

    You can perform a port mapping in order to check:

    nmap -p 587 -T4 -v -Pn mail.eloike.com
    [...]
    PORT    STATE    SERVICE
    587/tcp filtered submission
    

    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:

    openssl s_client -connect mail.eloike.com:587
    

    I had this output:

    connect:errno=11
    

    That means connection refused.

    For more information, you have to contact your provider, or to change mailer!

    Login or Signup to reply.
  3. SMTP port 587 is a STARTTLS port, not TLS. This means that:

    • the initial connection to the mail server is unencrypted (in the clear)
    • the mail server should advertise STARTTLS in its greeating message, and
    • the client, seeing STARTTLS in the greeting, should issue a STARTTLS command to initiate an encrypted connection before sending credentials or any other data.

    Trying to establish an encrypted connection immediately will fail, e.g.:

    $ openssl s_client -4 -host mail.eloike.com -port 587
    CONNECTED(00000003)
    140052717310400:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:252:
    # ...
    

    Trying to establish an unencrypted connection upgraded with STARTTLS will succeed, e.g.:

    $ openssl s_client -4 -host mail.eloike.com -port 587 -starttls smtp
    CONNECTED(00000003)
    # ...
    250 HELP
    

    You’ll need to read up on cPanel to see if it can support outgoing STARTTLS connections (I know it can support incoming connections).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search