cakephp 2.7 电子邮件发送问题。不允许使用 SMTP 身份验证方法,请检查 SMTP 服务器是否需要 TLS

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

我想使用 iPage smtp 发送电子邮件,它正在发送电子邮件 但是当我尝试使用 mail.mydomain.com 发送它时,它显示以下错误

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

我也 true tls= true/false,'tls' => true 它给出了这个错误

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

我尝试了很多方法但没有成功,我如何在 cakephp 2.7 中追踪问题

错误记录在 tmp/error。日志是

    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('admin@mydomain.com', '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}

已编辑:添加以下代码

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

我希望这对你有用,让我们知道结果

class EmailConfig {
 public $smtp = array(
    'transport' => 'Smtp',
    'from' => array('admin@mydomain.com' => 'admin'),
    'host' => 'mail.mydomain.com',
    'port' => 25,
    'timeout' => 30,
    'username' => 'admin@mydomain.com',
    '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',
 );
}

请进行 post 更新