Laravel error when sending custom email address using smtp server

13,868

Solution 1

You're using SSL (MAIL_ENCRYPTION=ssl) so you need to change MAIL_PORT=465 in .env file.

Solution 2

SSL VS TLS encryption

for TLS use Port : 587 for SSL use Port : 465

Solution 3

You might have crossed check every bit of line you have. The issue is with mailtrap.io it self. If your configuration is actually like this below.

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=31466861b7bXXX
MAIL_PASSWORD=fe2b6503618XXX
MAIL_ENCRYPTION=null

I tested with two separate framework to proof this error. check the SMTP credentials try resetting the credentials.

Share:
13,868

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I have a project that has a module that sends email from request. Im using beautymail package for the email template. I can send an email using a gmail account, but there is this email that I get from my client that has a custome email address in it. Like this [email protected], they said that the email is a smtp server. So I tried configuring my .env and other configuration files in laravel. But I get this error upon sending Connection could not be established with host mail.propnex.sg :stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number Could someone tell me why Im getting this error and what should I do to get rid of this? Thanks a lot

    .env config

    MAIL_DRIVER=smtp
    MAIL_HOST=mail.propnex.sg
    MAIL_PORT=587
    [email protected]
    MAIL_PASSWORD=xxxxxxxx
    MAIL_ENCRYPTION=ssl
    

    Mail.php

       'from' => [
            'address' => '[email protected]',
            'name' => 'Propnex',
        ],
    
        'reply_to' => ['address' => '[email protected]', 'name' => 'Propnex'],
    
        'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    
    
        'username' => env('MAIL_USERNAME'),
    
        'password' => env('MAIL_PASSWORD'),
    
        'port' => env('MAIL_PORT', 587),
    
        'driver' => env('MAIL_DRIVER', 'smtp'),
    
        'host' => env('MAIL_HOST', 'mail.propnex.sg'),