Verified Commit 67282b16 authored by Korko's avatar Korko
Browse files

Fix DKIM

parent 051bbc34
......@@ -3,17 +3,43 @@
namespace App\Mail;
use Illuminate\Mail\Mailable as BaseMailable;
use Swift_Signers_DKIMSigner;
class Mailable extends BaseMailable
{
/**
* Send the mail and call the success method if exists
* Send the message using the given mailer and call the success method if exists
*
* @param \Illuminate\Contracts\Mail\Factory|\Illuminate\Contracts\Mail\Mailer $mailer
* @return void
*/
public function send($mailer)
{
// Sign DKIM
$this->withSwiftMessage(function ($message) {
if (
config('mail.dkim_private_key') &&
file_exists(config('mail.dkim_private_key')) &&
config('mail.dkim_selector') &&
config('mail.dkim_domain')
) {
$signer = new Swift_Signers_DKIMSigner(
file_get_contents(config('mail.dkim_private_key')),
config('mail.dkim_domain'),
config('mail.dkim_selector'),
config('mail.dkim_passphrase')
);
$signer->setHashAlgorithm(config('mail.dkim_algo'));
if (config('mail.dkim_identity')) {
$signer->setSignerIdentity(config('mail.dkim_identity'));
}
$message->attachSigner($signer);
}
});
parent::send($mailer);
if (method_exists($this, 'success')) {
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "62bb4f549a9bc3e55885846d73717e47",
"content-hash": "286c275bf9c846c8c2946534c7525b7f",
"packages": [
{
"name": "anhskohbo/no-captcha",
......@@ -1339,61 +1339,6 @@
},
"time": "2020-11-26T19:24:33+00:00"
},
{
"name": "korko/laravel-dkim",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/Korko/laravel-dkim.git",
"reference": "a43fd47e7418bea4b6a0e5e42b155cd523350e9f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Korko/laravel-dkim/zipball/a43fd47e7418bea4b6a0e5e42b155cd523350e9f",
"reference": "a43fd47e7418bea4b6a0e5e42b155cd523350e9f",
"shasum": ""
},
"require": {
"laravel/framework": "~7.0|~8.0",
"php": "^7.1|^8.0"
},
"default-branch": true,
"type": "library",
"extra": {
"laravel": {
"providers": [
"Vitalybaev\\LaravelDkim\\DkimMailServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Vitalybaev\\LaravelDkim\\": "src/"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Vitaly Baev",
"email": "hello@vitalybaev.ru"
},
{
"name": "Ricardo Boss",
"email": "contact@ricardoboss.de"
},
{
"name": "Jeremy 'Korko' Lemesle",
"email": "jeremy.lemesle@korko.fr"
}
],
"description": "Laravel package for signing outgoing messages with DKIM.",
"support": {
"source": "https://github.com/Korko/laravel-dkim/tree/master"
},
"time": "2021-01-04T19:07:08+00:00"
},
{
"name": "korko/validator",
"version": "dev-master",
......@@ -10277,7 +10222,6 @@
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"korko/laravel-dkim": 20,
"korko/validator": 20,
"martinlindhe/laravel-vue-i18n-generator": 20,
"matt-allan/laravel-code-style": 20
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment