Configure Swiftmailer for DKIM signature

Does anyone know how to set up the Swiftmailer signer in config? I can see how to do it in the Swiftmailer docs, but I would like to have it in Yii2 config.
…Something like this:

    'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => false,
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => '',
                'username' => 'myusername',
                'password' => 'mypassword',
                'port' => '587',
                'encryption' => 'tls',
                'signCertificate' => ['/path/to/dkim_private_key.pem'],

Did you see this thread? It’s not 100 the same but maybe you need to pass in a different class


Yes, I saw that. That thread also has this comment:

That’s what I want to do. I know it can be done but I’m having trouble finding out how to do it. I want to avoid adding it to every email as shown further down in that thread.

Did you ever solve this? How to add it to the mailer config instead of at runtime?

I had it added at the server level. I hired someone to set up my mail server, so I’m afraid I can’t shed any light on how that was done.