Reputation: 25
when I use the following code in my IndexController.php I get the error as displayed below the code:
code in IndexController.php
<?php
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$config = array
(
'auth' => 'login',
'username' => '[email protected]',
'password' => 'mypass',
'ssl' => 'ssl',
'port' => 465,
);
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$mail = new Zend_Mail();
$mail->addTo('[email protected]', 'me' )
->setFrom('[email protected]', 'me')
->setSubject('your trial at fitness first')
->setBodyText('email body in plain text')
->send($transport);
}
}
Error displayed on the page :
An error occurred
Application error
I never edited any other files just installed zend and created a new project and went on as the tutorial said ...
But I'm stuck @ the above error
Upvotes: 0
Views: 227
Reputation: 2137
If you are using Gmail, try to change the config to:
$config = array
(
'auth' => 'login',
'username' => '[email protected]',
'password' => 'mypass',
'ssl' => 'tls',
'port' => 587,
);
If it works, the problem of your previous version should be that openssl is not enabled in your php.ini file
Upvotes: 0
Reputation: 4757
This is fairly complicated to explain, but I try.
When an error happens in ZF, normally an Exception is thrown. This kicks in your ErrorController.
In that ErrorController you only get the stack trace and an error message when you specified
phpSettings.display_errors = 1
in application/configs/application.ini
for your currently used APPLICATION_ENV
Take a look at: http://framework.zend.com/manual/en/zend.application.quick-start.html there it is described how it works.
An easy way to set your APPLICATION_ENV is put this in your .htaccess
file
SetEnv APPLICATION_ENV development
It's all described in the link.
Then edit your application/configs/application.ini
like:
[development]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
Upvotes: 1