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



我在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();

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

我在代码中省略了这一行:

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

希望这对其他人有用!

最新更新