Skip to content

[Mailer] Signing email is not working with templated email #42407

Closed
@kriskoch

Description

@kriskoch

Hello,
I am using the templated Email, and if I try to sign the message with DKIM, I receive the error 'A message must have a text or an HTML part or attachments.'

It seems like BodyRenderer isnt called until you send. Is there an event listener or something I need to tap into to sign it after the bodyrenderer is called?
If so then the documentation should be updated as I dont see anything on there.

Here is an example:

    $email = (new TemplatedEmail())
            ->to(new Address('example@example.org', 'Mr. Example' ))
            ->from(new Address('example@example.org', 'Ms. Example'))
            ->subject('Test Signed Email')
            ->htmlTemplate('email-templates/test.html.twig');


        $signer = new DkimSigner('file://'.$keyFile, $domain, $selector);
        $signed = $signer->sign($email);
        $mailer->send($signed);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions