次の手順で外部 SMTP サーバーを使用するように依頼されました。
「ポート 25 に平文で接続してから、STARTTLS を発行して TLS/SSL を開始する必要があります。その後、ログインしてください」
これは可能ですか?可能であれば、どのようにすればよいですか? 私が理解しているように、これは smtp 接続配列で TLS を true に設定することとは異なります。そうですか?
更新 ここで勝利に向かって突き進んでいます。SmtpTransport.php のコードを見ると、コメントにリンクされている仕様と一致していることがわかりますが (明らかに)、ブロック 102-107 はホストをクライアントまたはローカルホストに設定しているようです。ホスト構成。私はそれを間違っていますか?
ケーキコード:
protected function _connect() {
$this->_generateSocket();
if (!$this->_socket->connect()) {
throw new SocketException(__d('cake_dev', 'Unable to connect to SMTP server.'));
}
$this->_smtpSend(null, '220');
if (isset($this->_config['client'])) {
$host = $this->_config['client'];
} elseif ($httpHost = env('HTTP_HOST')) {
list($host) = explode(':', $httpHost);
} else {
$host = 'localhost';
}
try {
$this->_smtpSend("EHLO {$host}", '250');
if ($this->_config['tls']) {
$this->_smtpSend("STARTTLS", '220');
$this->_socket->enableCrypto('tls');
$this->_smtpSend("EHLO {$host}", '250');
}
} catch (SocketException $e) {
if ($this->_config['tls']) {
throw new SocketException(__d('cake_dev', 'SMTP server did not accept the connection or trying to connect to non TLS SMTP server using TLS.'));
}
try {
$this->_smtpSend("HELO {$host}", '250');
} catch (SocketException $e2) {
throw new SocketException(__d('cake_dev', 'SMTP server did not accept the connection.'));
}
}
}
私のメール設定:
public $smtp = array(
'transport' => 'Smtp',
'from' => array('me@example.com' => 'my name'),
'host' => 'secretipaddress',
'port' => 25,
'timeout' => 30,
'username' => 'me@example.com',
'password' => 'secretpassword',
'client' => null,
'log' => true,
'tls' => true
);