Mailer transport smtp is not available

Hello,

i have a little problem with smtp mailer. The config for smtp works on xampp, but not on my server.

app.php

'EmailTransport' => [
    'default' => [
        'className' => 'Smtp',
        /*
         * The keys host, port, timeout, username, password, client and tls
         * are used in SMTP transports
         */
        'host' => 'example.com',
        'port' => 587,
        'timeout' => 30,
        
        'username' => "noreply@example.com",
        'password' => "password",
        'client' => null,
        'tls' => true,
        'starttls' => true,
        'context'=>array('ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        )),

    ],
],

'Email' => [
        'default' => [
            'transport' => 'default',
            'from' => 'noreply@afjesproche.de',
            /*
             * Will by default be set to config value of App.encoding, if that exists otherwise to UTF-8.
             */
            //'charset' => 'utf-8',
            //'headerCharset' => 'utf-8',
        ],
    ],

Error:

Mailer transport smtp is not available.
BadMethodCallException

/var/www/vendor/cakephp/cakephp/src/Mailer/TransportRegistry.php[Toggle Arguments](https://example.com/survey/create#)

||`     * @throws \BadMethodCallException`|
| --- | --- |
||`     */`|
||`    protected function _throwMissingClassError(string $class, ?string $plugin): void`|
||`    {`|
||`        throw new BadMethodCallException(sprintf('Mailer transport %s is not available.', $class));`|
||`    }`|
||``|
||`    /**`|
||`     * Create the mailer transport instance.`|

Where is the fault?

Thanks.

Hii there,

Would you mind showing us the code used to send the mail from your app?

The configuration you’ve shown has the transport as Smtp, but the error message says smtp. The former is correct; the capital is required due to case sensitivity of the Linux file system. Do you have some other config somewhere that’s setting it to smtp instead of Smtp?

1 Like

You have eagle eyes, sir/madam.
I didn’t even spot that.