user2610146 user2610146 - 4 months ago 105
PHP Question

Cakephp 3 Unknown Email error

I wanted to ask about sending emails in cakephp3.

I am using cakephp3 docs, and configured everything as example shows.

But, when i try to send mail, this error appear:

Could not send email: unknown

'EmailTransport' => [

'default' => [
'className' => 'Mail',
// The following keys are used in SMTP transports
'host' => '',
'port' => 465,
'timeout' => 30,
'username' => '',
'password' => 'password',
'client' => null,
'tls' => null,


public function contact() {

if (isset($this->request->data) AND ($this->request->is('post'))) {
$email = new Email('default');
if ($email->from(['' => 'My Site'])->to('')->subject('Hello')->send('Message')) {
//pr( 'ok');

My question is, is this generic error message, which may have many reasons, in my opinion, it has no value in context od debug.
Thanks for reply.

ndm ndm

You want to use an SMTP server, but you've configured to use the Mail transport!

The className option should be set to Smtp. The host should probably also be different (ssl:// prefixed), or you should enable TLS, please be sure that you read through the questions/answers found with the search linked below.

See also