user10182659
user10182659

Reputation:

cakephp 2.7 email sending issue. SMTP authentication method not allowed, check if SMTP server requires TLS

I wanted to send email using iPage smtp it is sending email but when I try to send it using mail.mydomain.com it shows the following error

SMTP authentication method not allowed, check if SMTP server requires TLS.

I also trues tls= true/false, with 'tls' => true it gives this error

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

I tried many things but no luck, how can I trace the issue in cakephp 2.7

error logged at tmp/error.log is

    2018-08-05 15:02:05 Error: [SocketException] SMTP authentication method not allowed, check if SMTP server requires TLS.
    Request URL: /survey/clearance_forms/check
    Stack Trace:
    #0 C:\wamp64\www\survey\lib\Cake\Network\Email\SmtpTransport.php(87): SmtpTransport->_auth()
    #1 C:\wamp64\www\survey\lib\Cake\Network\Email\CakeEmail.php(1173): SmtpTransport->send(Object(CakeEmail))
    #2 C:\wamp64\www\survey\app\Controller\Component\SendComponent.php(60): CakeEmail->send('<html><body sty...')
    #3 C:\wamp64\www\survey\app\Controller\ClearanceFormsController.php(424): SendComponent->email(Array)
    #4 C:\wamp64\www\survey\app\Controller\ClearanceFormsController.php(406): ClearanceFormsController->studentEmail('[email protected]', 'testing')
    #5 [internal function]: ClearanceFormsController->check()
    #6 C:\wamp64\www\survey\lib\Cake\Controller\Controller.php(491): ReflectionMethod->invokeArgs(Object(ClearanceFormsController), Array)
    #7 C:\wamp64\www\survey\lib\Cake\Routing\Dispatcher.php(193): Controller->invokeAction(Object(CakeRequest))
    #8 C:\wamp64\www\survey\lib\Cake\Routing\Dispatcher.php(167): Dispatcher->_invoke(Object(ClearanceFormsController), Object(CakeRequest))
    #9 C:\wamp64\www\survey\app\webroot\index.php(111): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
    #10 {main}

EDITED: to add the following code

class EmailConfig {
    public $smtp = array(
        'transport' => 'Smtp',
        'from' => array('[email protected]' => 'admin'),
        'host' => 'mail.mydomain.com',
        'port' => 25,
        'timeout' => 30,
        'username' => '[email protected]',
        'password' => '********',
        'client' => null,
        'log' => false,
        //'tls' => true, /*tried true false both*/
        //'auth' => true, /*tried true false both*/     
        'charset' => 'utf-8',
        'headerCharset' => 'utf-8',
    );
}

Upvotes: 1

Views: 3094

Answers (1)

alamnaryab
alamnaryab

Reputation: 1484

i hope this will work for you, let us know about result

class EmailConfig {
 public $smtp = array(
    'transport' => 'Smtp',
    'from' => array('[email protected]' => 'admin'),
    'host' => 'mail.mydomain.com',
    'port' => 25,
    'timeout' => 30,
    'username' => '[email protected]',
    'password' => '********',
    'client' => null,
    'log' => false,
    /*********************** changes starts here ************/
    'SMTPSecure' => 'starttls',
    'tls' => true,
    'context'=>array('ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )), 
    /*********************** changes ends here ************/   
    'charset' => 'utf-8',
    'headerCharset' => 'utf-8',
 );
}

Please do post updates

Upvotes: 1

Related Questions