服务器上的CakeEmail问题 [英] CakeEmail problems on server

查看:193
本文介绍了服务器上的CakeEmail问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用cakeEmail的简单形式和本地主机它工作很好,但在服务器(托管)它显示我这个错误:

I'm using cakeEmail for simple form and on localhost it worked great, but on server(hosting) It shows me this error:

CONNECTION REFUSED
Error: An Internal Error Has Occurred.
Stack Trace

CORE/Cake/Network/Email/SmtpTransport.php line 101 → CakeSocket->connect()
CORE/Cake/Network/Email/SmtpTransport.php line 61 → SmtpTransport->_connect()
CORE/Cake/Network/Email/CakeEmail.php line 1124 → SmtpTransport->send(CakeEmail)
APP/Controller/ProductsController.php line 26 → CakeEmail->send(string)
[internal function] → ProductsController->email()
CORE/Cake/Controller/Controller.php line 490 → ReflectionMethod->invokeArgs(ProductsController, array)
CORE/Cake/Routing/Dispatcher.php line 187 → Controller->invokeAction(CakeRequest)
CORE/Cake/Routing/Dispatcher.php line 162 → Dispatcher->_invoke(ProductsController, CakeRequest, CakeResponse)
APP/webroot/index.php line 111 → Dispatcher->dispatch(CakeRequest, CakeResponse)

我不知道问题在哪里。

I have no idea where is the problem.

我的配置/ email.php:

my Config/email.php:

public $default = array(
        'transport' => 'Smtp',
        'from' => array('info@olvi.cz' => 'My Site'),
        'host' => 'smtp.savana.cz',
        'port' => 25,
        'timeout' => 30,
        'username' => 'info@olvi.cz',
        'password' => '****',
        'client' => null,
        'log' => false,
);

我的ProductsController.php:

My ProductsController.php:

public function email(){
    App::uses('CakeEmail', 'Network/Email');
    if ($this->request->is('post')) {
        $email = new CakeEmail('default');
        $email->from(array('info@olvi.cz' => $this->request->data['Email']['name']));
        $email->to($this->request->data['Email']['sender']);
        $email->subject($this->request->data['Email']['name']);
        $email->send($this->request->data['Email']['message']);
        $this->Session->setFlash(__('Zpráva byla odeslána.'));
    }
}

并查看email.ctp:

and view email.ctp:

echo $this->Form->create('Email');
echo $this->Form->input('name',array('label' => 'Jméno', 'required' => 'required'));
echo $this->Form->input('sender',array('type' => 'email','label' => 'Váš e-mail', 'required' => 'required'));
echo $this->Form->input('message', array('type' => 'textarea', 'label' => 'Zpráva', 'required' => 'required'));
echo $this->Form->submit('Odeslat', array('id' => 'button', 'div' => false));
echo $this->Form->end();

我试图在我的托管helplink上调用,他们不知道,但PHPMailer工作。
使用cakePHP的Im新功能,所以我在服务器上移动它有问题。任何人可以elp请吗?

I tried to call on my hosting helplink and they have no idea but says that PHPMailer works. Im new with cakePHP so Im having problems with moving it on server. Can anyone elp please? Im really deep in this problem.

谢谢

推荐答案

strong>可能原因:

Probable Causes:


  1. 您运行的服务器在其IP地址上是否有垃圾邮件阻止?有可能是SMTP服务器不允许从托管服务器连接。因此,错误 CONNECTION REFUSED 。它不是在您运行代码的服务器上,而是您尝试登录的服务器。

  1. Does the server your running from have a spam block on its IP addresses? Chances are the SMTP server is not permitting the connection from your hosting server. Thus the error CONNECTION REFUSED. It is not something on the server you are running the code from, but the server you are trying to log in to.

SMTP凭证不正确。也许有东西丢失。请尝试使用其他位置的凭据连接,以查看是否可以实际连接。

The SMTP credentials are not correct. Maybe there is something missing. Try connecting using those credentials from another location to see if you can actually connect.

是您运行的同一主机的SMTP凭据。也许主机不允许与SMTP的出站连接,以防止其服务器被用作垃圾邮件发送机。

Are the SMTP credentials for the same host you are running from. Maybe the host doesn't permit the outbound connection to SMTP to prevent their servers from being used as a spam sending machine.

可能的解决方案

如果没有可能的原因是罪魁祸首,也许配置有问题。您有:

If none of the probably causes are the culprit, maybe there is a problem with the configuration. You have this:

public $default = array(
    'transport' => 'Smtp',
    'from' => array('info@olvi.cz' => 'My Site'),
    'host' => 'smtp.savana.cz',
    'port' => 25,
    'timeout' => 30,
    'username' => 'info@olvi.cz',
    'password' => '****',
    'client' => null,
    'log' => false,
);

尝试简化它并将其更改为最小值:

Try simplifying it and changing it to the bare minimums:

public $default = array(
    'transport' => 'Smtp',
    'host' => 'smtp.savana.cz',
    'port' => 25,
    'username' => 'info@olvi.cz',
    'password' => '****',
);

这篇关于服务器上的CakeEmail问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆