【问题标题】:SMTP mail options with tls in cakephp 1.3cakephp 1.3 中带有 tls 的 SMTP 邮件选项
【发布时间】:2015-01-30 08:00:45
【问题描述】:

我正在使用 smtp 选项发送邮件。当我通过 ssl 发送邮件时,它工作正常。但是当我尝试通过 tls 发送邮件时,它无法正常工作。 我的应用程序在 CakePHP 1.3 中。

function testemail() {
    $from = 'test@domain.com';
    $this->Email->delivery='smtp';
    $this->Email->smtpOptions = array(
      'port'=>'portnumber',
      'auth' => true,
      'host' => 'tls://smpt.xxxx.com',
      'username'=>'test@domain.com',
      'password'=>'xxxxxxxxx',
    );
    $this->Email->to = 'xxxxxx@gmail.com';
    $this->Email->subject = 'Test Email';
    $this->Email->from =  $from;            
    $this->Email->replyTo =  $from;         
    $this->Email->return = $from;
    $this->Email->additionalParams = '-f'.$from;
    $this->Email->sendAs = 'html';
    $this->Email->template = 'template';
    $this->set('template','Testing TLS mail');

    if($this->Email->send()) {
        $this->Session->setFlash(__('Mail sent.', true));
    } else {
        $this->Session->setFlash(__('Error.', true));
    }
}

谢谢

【问题讨论】:

    标签: email cakephp smtp-auth


    【解决方案1】:

    如果您的服务器支持 SSL,请尝试此替代方案:

      'port' => '465',
      'host' => 'ssl://smpt.xxxx.com',
    

    【讨论】:

      猜你喜欢
      • 2014-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多