简体   繁体   中英

Laravel 5: Signing e-mail with DKIM

In my project I'm trying to send e-mail through my own SMTP server using Laravel 5. I have everything set up correctly using the SMTP driver and I'm managing to send and receive e-mail fine.

I want to get set up using DKIM. I've set up my public key and made it available in my DNS and I have a private key ready to start signing my messages.

However, I can't find any documentation on how to set up DKIM signing using Laravel/Swift Mailer. I've managed to sign my e-mails with DKIM before in another non-Laravel project that used PHPMailer but can't find any way of doing it here. I've had a browse through Illuminate\\Mail\\Message and Illuminte\\Mail\\Mailer but can't find anything relevant.

Does anyone know how to do this?

Current example code:

public function handle(UserWasRegistered $event)
{
    $user = $event->getUser();

    $this->mailer->send(['emails.users.welcome.html', 'emails.users.welcome.text'], ['user' => $user], function($message) use($user) {
        $message->subject('Welcome to XXXXXX');
        $message->to($user->email);
    });
}

Ideally, I would like to be able to provide my DKIM private key in the config somewhere and have Laravel/Swift Mailer (Or write some code once) sign my messages for me.

Cheers

I wrote decorator of MailServiceProvider for Laravel 5 that provides ability to sign outgoing messages with DKIM:

https://github.com/vitalybaev/laravel5-dkim

You have to extend Laravel Mailer and mail service provider. Default laravel mailer using new Swift_Message class not Swift_SignedMessage thats why you don't have options for signing.

Here is a package for laravel 4 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM