I am trying to send a email message using CakePhp 2.0. in my controller i use this code (i know it's fine, i took it from the cookbook) :
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail("myConfig");
$email->from(array('[email protected]' => 'From Example'));
$email->to($to);
$email->subject($msgtitle);
$ok = $email->send($content);
and in app/config/email.php
i have this config :
<?php
class EmailConfig {
public $myConfig = array(
'host' => 'mail.myServer.com',
'port' => 587,
'username' => 'mYaccount',
'password' => 'secret',
'transport' => 'Smtp'
);
}
?>
the problem is the server answers with :
SMTP Error: 530 5.7.0 Must issue a STARTTLS command first.
the account name is correct, as is the password. The config works when loading it up in thunderbird, the connection to the smtp server is set up as :
server name : mail.myServer.com
port : 587
connection security : STARTTLS
authentication : normal password
user name : mYaccount
Are you certain your SMTP supports tls? Try sending the ehlo command:
telnet 1.2.3.4 25
ehlo testing
You should see something like:
250-STARTTLS
in the list.
If you see it, then it is most likely not enabled. You will need to enable it. If you do not see it, you will need to add it.