在我的模型中,我在创建用户后发送电子邮件:
型号/ user.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();
}
}
配置/ email.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&amp; 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) ...
只有一个区别: 在生产系统中,我使用内置的重写功能。
答案 0 :(得分:0)
切换到gmail就像一个魅力。感谢您的推荐。