I have the following problem, as you may have imagined by the title I have a CakePHP v2.5.6 application with a contact form, and it's giving me an authentication error every time I submit it, how was my surprise, after trying a simple test using PHPMailer it works perfectly with apparently the same configuration.
CakePHP configuration (app/Config/email.php)
<?php
class EmailConfig {
public $info = array(
'transport' => 'Smtp',
'host' => 'smtp.foo.com',
'port' => 25,
'username' => 'username',
'password' => 'password'
);
}
CakePHP sender code
CakeEmail::deliver('foo@foo.es', 'Subject', 'Test', 'info');
CakePHP error report
PHPMailer test script
<?php
require './PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = 'smtp.foo.com';
$mail->SMTPAuth = true;
$mail->Username = 'username';
$mail->Password = 'password';
$mail->Port = 25;
$mail->setFrom('info@example.es', 'Mailer');
$mail->addAddress('foo@foo.es', 'Mr. foo');
$mail->addReplyTo('info@example.es', 'Information');
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
So my question is, is there actually any differences between configurations, or I'm missing something? Why is PHPMailer working and CakeEmail isn't?
Thank you in advance :)