简体   繁体   中英

Sending email works on test but not on production system

In my model I'm sending an email once the User is created:

Model/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();
    }
}

Config/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',
);

It's working fine on my testing system but not on production system (1&1 webhosting):

Error: An Internal Error Has Occurred.

According to error.log:

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

and

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

There is only 1 difference: In production system I use the built in re-writing function.

Switching to gmail worked like a charm. Thanks for the recommondations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM