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.
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,
);
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.'));
}
}
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();
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.
Thank you