0

CakePHP (CakeMail) を使用して Microsoft Exchange 2010 Server に電子メールを送信するために、いくつかの構成オプションを試してきました。これは私の現在の構成です:

    public $default = array(
    'transport' => 'Smtp',
    'from' => array('email@example.com' => 'Me'),
    'host' => 'smtp.ex3.secureserver.net',
    'port' => 587,
    'timeout' => 30,
    'username' => 'verifiedUserName',
    'password' => 'verifiedPassword',
    'client' => null,
    'log' => true,
    'delivery' => 'smtp'
);

そして、これは私のテスト関数です:

    public function test_email() {
    App::uses('CakeEmail', 'Network/Email');
    $email = new CakeEmail();
    $email->config('default');
    debug($email->config());
    $result = $email->template('checkout')
            ->from('email@example.com')
            ->emailFormat('text')
            ->to('another@example.com')
            ->subject('TEST EMAIL ')
            ->send();
}

私は取得しています

SMTP Error: 504 5.7.4 Unrecognized authentication type

ホストを「ssl://smtp.ex3.secureserver.net」または「tls://smtp.ex3.secureserver.net」に変更すると、

Unable to connect to SMTP server.

サーバーは TLS を使用するように構成されています。

何か案は ?

4

2 に答える 2

3

(本から) http://book.cakephp.org/2.0/en/core-utility-libraries/email.html#configuration

2.3.0 以降、tls オプションを使用して TLS SMTP を有効にすることもできます。

<?php
class EmailConfig {
    public $gmail = array(
        'host' => 'smtp.gmail.com',
        'port' => 465,
        'username' => 'my@gmail.com',
        'password' => 'secret',
        'transport' => 'Smtp',
        'tls' => true
    );
}

機能プル リクエストの参照はこちら > https://github.com/cakephp/cakephp/pull/734

于 2012-10-17T16:40:03.247 に答える
2

$default設定では「tls」=>trueを使用する必要があります。

于 2012-09-17T11:44:05.767 に答える