Cakephp CakeEmail和SMTP错误535

Cakephp CakeEmail和SMTP错误535,cakephp,smtp,cakephp-2.3,Cakephp,Smtp,Cakephp 2.3,我使用的是CakePHP2.3.0,我想用DevCot+postfix发送电子邮件。SMTP工作正常,因为我安装了roundCube和hi,可以接收和发送电子邮件 class EmailConfig { public $default = array( 'host' => 'poczta.example.com', 'port' => 25, 'auth' => 'plain', 'username' => 'username@poczta

我使用的是CakePHP2.3.0,我想用DevCot+postfix发送电子邮件。SMTP工作正常,因为我安装了roundCube和hi,可以接收和发送电子邮件

class EmailConfig {
public $default = array(
    'host' => 'poczta.example.com',
    'port' => 25,
    'auth' => 'plain',
    'username' => 'username@poczta.example.com',
    'password' => '**********',
    'tls' => true,
    'transport' => 'Smtp',
    'from' => array('username@poczta.example.com' => 'Username'),
    'returnPath' => 'username@poczta.example.com',
    'layout' => false,
    'emailFormat' => 'html',
    'template' => 'only_text',
    'charset' => 'utf-8',
    'headerCharset' => 'utf-8',
);
}

发送电子邮件的代码:

        try {
            $oEmail->reset();
            $oEmail->config('default');
            $oEmail->to(preg_replace('/&#?[a-z0-9]+;/i', '' , trim($v['Email']['email']) ));
            $oEmail->subject($subject);
            $content = str_replace('${id}', md5($v['Email']['id']), $context);
            $content = str_replace('queueId', $queueId, $content);
            $oEmail->viewVars(array('email' => $content));
            if($oEmail->send()) {
                $last = $v['Email']['id'];
                $send++;
            }
        }
        catch(Exception $e) {
            $this->out($e->getMessage());
        }
我明白了,我可以安慰你:

SMTP Error: 535 5.7.8 Error: authentication failed: Invalid authentication mechanism
因此,使用telnet进行快速测试:

telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 poczta.example.com ESMTP Postfix (Debian/GNU)
ehlo testing
250-poczta.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
所以,请帮助我如何发送电子邮件使用蛋糕?
编辑:我在电子邮件配置文件中有tls。

它不是配置中的tsl,而是tls

您可以使用任何其他工具连接吗?检查端口、主机名、密码以及是否确实需要使用tls