Sendmail()需要很长时间才能执行

时间:2012-01-30 15:10:38

标签: php cakephp smtp sendmail ubuntu-10.10

我在Linux服务器(Ubuntu 10.10)上使用来自PHP(CakePHP 1.3)的sendmail,并且它将永远执行,但最终会通过。 SMTP作为守护进程运行 - 有一段时间,我认为问题是它必须在每个send()上启动进程。

在服务器配置方面,我有点新手,所以感谢任何帮助。

这是我的应用程序代码,供参考:

            $this->Email->from    = 'Hello <hello@example.com>';
            $this->Email->to      = 'Hello <hello@example.com>';
            $this->Email->subject = 'Hello';
            $this->Email->sendAs = 'html';
            $this->Email->template = 'my_template';
            $this->data['Inquiry']['id']= $this->Inquiry->id;
            $this->set('inquiry', $this->data['Inquiry']);
            $this->Email->send();

1 个答案:

答案 0 :(得分:2)

当然,我在发布问题后立即找到了解决方案。

我从代码中省略了这条必要的行:

$this->Email->delivery = 'smtp';

希望这对其他人有用!

相关问题