Sending Emails

Third-party services

Usually, your host's SMTP server will be very limited in sending emails, if it is possible at all. In addition, you will have a very high risk of your email landing in the spam folder of your members since certification of authenticity does not back them.

Unless you have a very good reason not to, I suggest using any third-party service to send emails you feel comfortable using. Their services vary greatly, and their pricing is based on the volume of emails sent.

Suggestions, some have their own Kirby CMS plugins for additional functionality:

My recommendation would be to use a .env file to store your credentials and use the ready-hook to apply the values once the dotenv plugin has them loaded.

site/config/config.my-production-server.com.php
<?php

return [
    'auth' => [
        'methods' => ['code', 'magic-link'],
        'challenge' => [
            'email' => [
                'from' => 'myverifiedsender@mydomain.com',
                'fromName' => 'My Name',
            ]
        ]
    ],
    'ready' => function () {
        return [
            'email' => [
                'transport' => [
                    'type' => 'smtp',
                    'host' => 'smtp.postmarkapp.com',
                    'port' => 587,
                    'security' => true,
                    'auth' => true,
                    'username' => env('POSTMARK_USERNAME'),
                    'password' => env('POSTMARK_PASSWORD'),
                ],
            ],
        ];
    },
];
In the case of Postmark, you will need to create a SMTP configuration for your broadcast channel.

Testing Emails

You could use tools like the free Mailhog or paid ones like HELO or HERD Pro to catch emails sent using your local SMTP server. If you need to test emails on an online staging server consider Mailtrap or similar alternatives.

The configuration for all of them is very similar only differing in set config values.

site/config/config.php
<?php

return [
    // https://getkirby.com/docs/cookbook/forms/using-mailhog-for-email-testing
    // OSX: brew install mailhog; brew services start mailhog
    // BROWSER: http://localhost:8025/
    'email' => [
        'transport' => [
            'type' => 'smtp',
            'host' => 'localhost',
            'port' => 1025,
            'security' => false,
        ],
    ],
    // other options
];

FavIcon and BIMI

You can do two things to get an image displayed for your email sender in the customer's email clients.

The simplest is having a favicon.ico file at the server's public HTML root matching the same domain.
Like emails from no-reply@example.com => https://example.com/favicon.ico

But the support for that is basic at best, and email clients like Gmail switched to certified BIMI SVG logos a while ago. That will require you to set up SPF, DKIM and DMARC and a 3rd party service will make this easier. To gain full email client support you will need to get your logo certified as a verified mark as explained by the BIMI Group.

Kirby Klub is not affiliated with the developers of Kirby CMS. We are merely standing on the shoulder of giants.
© 2025 Bruno Meilick All rights reserved.