I’m trying to send emails from CakePHP but without success. I’m trying with CakeEmail and this code:
$email = new CakeEmail();
$email->from(array('reynierpm@gmail.com' => __('Recruitment Job App')))
->to('reynierpm@gmail.com')
->subject(__('Recruitment Status Update'))
->send(__('Dear, ReynierPM this is a testing email'));
And doesn’t work because no emails is send. The file /app/Config/email.php have this configuration:
class EmailConfig {
public $default = array(
'transport' => 'Debug',
'host' => 'smtp.gmail.com',
'port' => 25,
'timeout' => 30,
'username' => 'mlrepemi@gmail.com',
'password' => 'secret_password',
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
);
}
I’ve try also this http://bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments-and-plugins but in this case I get this error:
Fatal error: Class ‘testemailView’ not found in /var/www/html/jobapp/app/Controller/Component/swift_mailer.php on line 245
I’m using CakePHP 2.0.6 and SwiftMailer 4.1.5, any help?
Cheers and thanks in advance
You are leaving out some important parts to enable email. You should have something like this:
Then in your email.php config, your default configuration for gmail should looke like this: