Reputation: 117
I'm using cakephp 2.3.0 and i want send email using devocot + postfix. SMTP work fine because i have installed roundCube and hi received emails and sends emails.
class EmailConfig {
public $default = array(
'host' => 'poczta.example.com',
'port' => 25,
'auth' => 'plain',
'username' => '[email protected]',
'password' => '**********',
'tls' => true,
'transport' => 'Smtp',
'from' => array('[email protected]' => 'Username'),
'returnPath' => '[email protected]',
'layout' => false,
'emailFormat' => 'html',
'template' => 'only_text',
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
);
}
Code for send emails:
try {
$oEmail->reset();
$oEmail->config('default');
$oEmail->to(preg_replace('/&#?[a-z0-9]+;/i', '' , trim($v['Email']['email']) ));
$oEmail->subject($subject);
$content = str_replace('${id}', md5($v['Email']['id']), $context);
$content = str_replace('queueId', $queueId, $content);
$oEmail->viewVars(array('email' => $content));
if($oEmail->send()) {
$last = $v['Email']['id'];
$send++;
}
}
catch(Exception $e) {
$this->out($e->getMessage());
}
And i see i console:
SMTP Error: 535 5.7.8 Error: authentication failed: Invalid authentication mechanism
So quick test with telnet:
telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 poczta.example.com ESMTP Postfix (Debian/GNU)
ehlo testing
250-poczta.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
So please help me how i sent email using cake ? EDIT: i have tls in email config file.
Upvotes: 1
Views: 1953
Reputation: 9614
It is not tsl
as you have it in your config, it is tls
Upvotes: 0