Cakephp 3.8 - The "default" transport configuration does not exist

1.3k Views Asked by At

I have:

  1. set up a cakephp 3.8 application.
  2. installed cakedc.users 8.4
  3. succesfully configured the facebook login integration

You can ignore the points 2 and 3 because my problem is on the registration email sending. When i try to sign up a user, the user is correctly added to DB but i can't receive any email. The page returns me:

The "default" transport configuration does not exist.

My app.php is configured as default:

    'EmailTransport' => [
        'default' => [
            'className' => MailTransport::class,
            /*
             * The following keys are used in SMTP transports:
             */
            'host' => 'localhost',
            'port' => 25,
            'timeout' => 30,
            'username' => null,
            'password' => null,
            'client' => null,
            'tls' => null,
            'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
        ],
    ],
    'Email' => [
        'default' => [
            'transport' => 'default',
            'from' => 'you@localhost',
            //'charset' => 'utf-8',
            //'headerCharset' => 'utf-8',
        ],
    ],

I can't figure out why my "default" emailTransport is not correctly loaded during sending process and so Mail() function returns me this error.

2

There are 2 best solutions below

1
bikash.bilz On

You haven't configured your transport for "default". You need to provide proper host, port, username, password to make it work. Follwing is the basic example of gmail transport configuration

'EmailTransport' => [
    'default' => [
        'host' => 'ssl://smtp.gmail.com',
        'port' => 465,
        'username' => '[email protected]',  //Your email id
        'password' => 'secret',   //password for the email id
        'className' => 'Smtp'
        'timeout' => 30,
        'client' => null,
        'tls' => null,
        'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
    ],
],

Learn of configuring email transport.

0
Disu On

I have the answer! I don't know why but in bootstrap.php the row 152:

TransportFactory::setConfig(Configure::consume('EmailTransport'));

was inside a comment. Removing comment configuration has been correctly read.