0

在我的模型中,一旦创建了用户,我就会发送一封电子邮件:

模型/用户.php:

<?php
App::uses('AppModel', 'Model');
App::uses('CakeEmail', 'Network/Email');

class User extends AppModel {
    ...
    private function sendWelcomeMail($name, $email, $password) {
        $Email = new CakeEmail('smtp');
        $Email->viewVars(array('name' => $name, 'password' => $password));
        $Email->template(('welcome'));
        $Email->emailFormat('html');
        $Email->from(array('info@staycomputer.de' => 'Stay Computer'));
        $Email->to($email);
        $Email->subject('Stay Serviceordersystem: Willkommen / Welcome');

        $Email->send();
    }
}

配置/电子邮件.php:

public $smtp = array(
    'transport' => 'Smtp',
    'from' => array('info@***.de' => 'Stay Computer'),
    'host' => '***',
    'port' => 25,
    'timeout' => 30,
    'username' => '***',
    'password' => '***',
    'client' => null,
    'log' => false,
    //'charset' => 'utf-8',
    //'headerCharset' => 'utf-8',
);

它在我的测试系统上运行良好,但在生产系统上运行良好(1&1 虚拟主机):

错误:发生内部错误。

根据error.log:

Error: [SocketException] Connection timed out Request URL ...

15:52:36 Error: Fatal Error (256): [CakeException] Unknown status code #0 /homepage/30/d20974062/htdocs/StaywebDB/serviceordersystem/lib/Cake/Error/ExceptionRenderer.php(212) ...

只有 1 个区别:在生产系统中,我使用内置的重写功能。

4

1 回答 1

0

切换到 gmail 就像一个魅力。感谢您的推荐。

于 2014-05-28T14:33:19.727 回答