SMTP server did not accept the connection or trying to connect to non TLS SMTP server using TLS on cakePHP

975 Views Asked by At

I get the following error on my cakePHP2.7 project when I move the code to my new server. The code works fine on all my existing servers.
error message

we are using aws SES as mail service. We created a sample file as instructed by https://docs.aws.amazon.com/ses/latest/dg/send-using-smtp-programmatically.html and that also works fine. Any help is appriciated

code for your reference

public $mailarr = array(
    'host'=>'email-smtp.us-west-2.amazonaws.com',
    'port' => 587,
    'username' => 'XXXXXXXXXXXXXXX',
    'password' => 'XXXXXXXXXXX',        
    'tls'=>true,
    'returnPath'=>'[email protected]',
    'transport' => 'Smtp',
    'from' => array('[email protected]' => 'Alert!'),
    'emailFormat' => 'html',
    'timeout' => 300,   
    );

I have tried to add the below as part of my mailarr but the error still persists

'context' => array(
            'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
            ),
        )
0

There are 0 best solutions below