【问题标题】:cakephp 2.7 email sending issue. SMTP authentication method not allowed, check if SMTP server requires TLScakephp 2.7 电子邮件发送问题。不允许使用 SMTP 身份验证方法,请检查 SMTP 服务器是否需要 TLS
【发布时间】:2018-08-05 11:45:09
【问题描述】:

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

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

我也认为 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.log 中记录的错误是

    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',
    );
}

【问题讨论】:

  • 请显示您用于发送电子邮件的代码,包括任何相关的配置详细信息(当然,用户名和密码已被混淆)。

标签: email tls1.2 cakephp-2.3


【解决方案1】:

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

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',
 );
}

请发布更新

【讨论】:

    猜你喜欢
    • 2011-02-12
    • 1970-01-01
    • 2011-10-14
    • 1970-01-01
    • 2017-09-07
    • 2011-06-18
    • 2021-08-13
    • 1970-01-01
    • 2021-10-02
    相关资源
    最近更新 更多