Description
Hello everyone,
I've just upgraded my Symfony projet from 5.0 to 5.2 because I needed to DKIM sign my emails (thanks to @fabpot).
I basically followed documentation by implementing my signature on my mail like that :
$email = (new TemplatedEmail())
->from(new Address('noreply@domain.com', 'Noreply'))
->to($userEmail)
->subject('Subject')
->text('My email text format')
->htmlTemplate('email.html.twig')
->context([
...
]);
$signer = new DkimSigner(
'file://'.dirname(__DIR__).'/../'.$this->getParameter('private_key_filename'),
$this->getParameter('domain_name'),
$this->getParameter('selector')
);
$signedEmail = $signer->sign($email);
$mailer->send($signedEmail);
I also tried by getting content :
$signer = new DkimSigner(
file_get_contents(dirname(__DIR__).'/../'.$this->getParameter('private_key_filename')),
$this->getParameter('domain_name'),
$this->getParameter('selector')
);
I still have "body has been altered" when using multiple DKIM lookup and the test fail.
I don't think there is a problem in charging the private key file because I first had those kind of errors that I fixed by adding the "/../" on the path.
I've set the public key on my DNS with TXT record and domain selector._domainkey.domain.com
like that :
v=DKIM1;k=rsa;p=mypublickey
I don't think this is a problem of key integrity because I used openssl to generate the private and public keys :
openssl genrsa -out private.key 1024
openssl rsa -in private.key -pubout -out public.key
And I can't sign my email by using my SMTP server because I'm having a mutualized offer and I can't change server configurations.
Did I miss something ?
Thank you for your time and I hope someone had the same problem !