How to add an email service?

In Kirby 2 we had email services and could easily add new ones. In Kirby 3 I only see PHPMailer and it seems hardcoded in the Kirby\Cms\App@email method. I would like to know if it’s possible to switch the default mailer. I like using Mailgun instead of SMTP.

you can not currently. phpmailer is hardwired.

but like another member said on slack you should be able to set smtp and other options to connect to 3rd party services. i have not tried myself yet but will have to during next 2 weeks. if you get it working please post your results. thanks.
https://getkirby.com/docs/guide/emails#transport-configuration

for mailgun probably something like this… see step 3… and use the values for kirbys config.

Thank you for pointing me in the right direction! This is the SMTP config that works with Mailgun:

'email' => [
    'transport' => [
        'type' => 'smtp',
        'host' => 'smtp.mailgun.org',
        'port' => 587,
        'security' => 'tls',
        'auth' => true,
        'username' => 'postmaster@sandbox***.mailgun.org', // for local test
        'password' => '***', // provided in the domain information
    ],
],

The from email address must be one validated with Mailgun too.

4 Likes