I'm currently rewriting a client's web application using cakephp. One of
the pages requires sending the data in a form to the company in an email.
I'm having problems with this in my development environment:
- Ubuntu 14.10
- Apache2/PHP with all the normal libraries like lib_php, mod_rewrite,
etc
- PHP 5.5
- CakePHP 2.5.4
After poking about a bit on the web, I've seen that I have to load
lib_openssl and that I should include the following line in my php.ini
file. So in /etc/php5/apache2/php.ini I've added the recommended line to
the Dynamic Extensions section:
extension=php_openssl.so
I'm not sure if this is correct because Ubuntu includes php_openssl via gnutls.
However, I don't know how to test this.
I've created an email.php file under app/Config with the following class
definition:
class EmailConfig {
public $gmail = array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => '[email protected]',
'password' => 'mypassword',
'transport' => 'Smtp',
);
}
The username and password are copied from Thunderbird, so should be OK.
Finally, I set up a test page under app/View/Pages, called email-tester.ctp
containing the code:
<?php
App::uses('CakeEmail', 'Network/Email');
$Email = new CakeEmail();
$Email->from(array('[email protected]' => 'My Gmail Address'))
->to('[email protected]')
->subject('About')
->send('My message');
?>
<p>Email sent...</p>
When I try to open this page at localhost/myproject/pages/email-tester I get an
error message as follows:
*Error: * An Internal Error Has Occurred.
Stack Trace
- CORE/Cake/Network/Email/MailTransport.php line 51
<http://localhost/unidirectory/pages/email-tester#> →
MailTransport->_mail(string,
string, string, string, null)
<http://localhost/unidirectory/pages/email-tester#>
- CORE/Cake/Network/Email/CakeEmail.php line 1158
<http://localhost/unidirectory/pages/email-tester#> →
MailTransport->send(CakeEmail)
<http://localhost/unidirectory/pages/email-tester#>
- APP/View/Pages/email-tester.ctp line 8
<http://localhost/unidirectory/pages/email-tester#> →
CakeEmail->send(string)
<http://localhost/unidirectory/pages/email-tester#>
- CORE/Cake/View/View.php line 948
<http://localhost/unidirectory/pages/email-tester#> → include(string)
<http://localhost/unidirectory/pages/email-tester#>
- CORE/Cake/View/View.php line 910
<http://localhost/unidirectory/pages/email-tester#> →
View->_evaluate(string,
array) <http://localhost/unidirectory/pages/email-tester#>
- CORE/Cake/View/View.php line 471
<http://localhost/unidirectory/pages/email-tester#> →
View->_render(string) <http://localhost/unidirectory/pages/email-tester#>
- CORE/Cake/Controller/Controller.php line 954
<http://localhost/unidirectory/pages/email-tester#> → View->render(string,
null) <http://localhost/unidirectory/pages/email-tester#>
- APP/Controller/PagesController.php line 69
<http://localhost/unidirectory/pages/email-tester#> →
Controller->render(string)
<http://localhost/unidirectory/pages/email-tester#>
- [internal function] <http://localhost/unidirectory/pages/email-tester#>
→ PagesController->display(string)
<http://localhost/unidirectory/pages/email-tester#>
- CORE/Cake/Controller/Controller.php line 490
<http://localhost/unidirectory/pages/email-tester#> →
ReflectionMethod->invokeArgs(PagesController,
array) <http://localhost/unidirectory/pages/email-tester#>
- CORE/Cake/Routing/Dispatcher.php line 191
<http://localhost/unidirectory/pages/email-tester#> →
Controller->invokeAction(CakeRequest)
<http://localhost/unidirectory/pages/email-tester#>
- CORE/Cake/Routing/Dispatcher.php line 165
<http://localhost/unidirectory/pages/email-tester#> →
Dispatcher->_invoke(PagesController,
CakeRequest) <http://localhost/unidirectory/pages/email-tester#>
- APP/webroot/index.php line 108
<http://localhost/unidirectory/pages/email-tester#> →
Dispatcher->dispatch(CakeRequest,
CakeResponse) <http://localhost/unidirectory/pages/email-tester#>
If anyone can decode this for me, or give me some idea as to what I should try
next, I'd be very grateful.
Thanks in advance
Peter
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.