I've been successfully using CakePHP's email component to send my email but due to restrictions I now need to set it up to use a smtp relay server and I'm getting some strange results.
Here is my code:
$this->Email->to = $user['User']['username'].' <'.$user['User']['email'].'>';
$this->Email->subject = 'MyWebsite.com – Please confirm your email address';
$this->Email->from = 'MyWebsite.com <[email protected]>';
$this->Email->template = 'user_confirm';
$this->Email->sendAs = 'html';
$this->Email->smtpOptions = array(
'timeout' => '30',
'port' => '25',
'host' => 'mail.myrelayserver.com',
'username' => 'USERNAME',
'password' => 'PASSWORD'
);
$this->Email->delivery = 'smtp';
if ($this->Email->send()) {
return true;
} else {
echo $this->Email->smtpError;
}
Now whenever I try and send this email, the send fails and I get the following ouput from $this->Email->smtpError:
14.2/Kp; Sun, 14 Feb 2010 19:11:07 GMT
Any ideas?