为JangoSmtp Cakephp配置获取错误“无路由到主机”

时间:2013-08-19 08:59:36

标签: cakephp routes smtp

这是我的代码:

    function sendMail($template = null, $to_email = null, $from_email = null,
   $subject = null,  $contents = array()) {
$this->Email->to  = $to_email;
$this->Email->subject = $subject;
$this->Email->from =$from_email;
$this->Email->template = $template;
$this->Email->sendAs = 'html';

$this->Email->smtpOptions = array(
    'timeout'=>'30',
    'port' => '25',
    'host' => 'relay.jangosmtp.net',
    'username' => 'users',
    'password' => 'pass',
    'transport' => 'Smtp',
    'tls' => true
);
$this->Email->delivery = 'smtp';


    $this->set('contents', $content);
    $this->Email->send();

}

我收到错误,因为“没有主持人的路由”有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

“无主机路由”表示这不是脚本问题,但更可能是邮件服务器的配置。

https://www.google.com/search?q=smtp+No+route+to+host