8000 Web profiler "Emails" tab breaks with signed emails · Issue #53928 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Web profiler "Emails" tab breaks with signed emails #53928
Closed
@jontjs

Description

@jontjs

Symfony version(s) affected

6.4.3

Description

When I use DkimSigner to sign an email and send it, the web profiler's "Emails" page fails to load.

How to reproduce

  1. create a new TemplatedEmail()
  2. sign the email using DkimSigner
  3. send the signed email
  4. open the web profiler for the request
  5. access the "Emails" page
  6. a Twig RuntimeError is thrown: Neither the property "getFrom" nor one of the methods "getFrom()", "getgetFrom()"/"isgetFrom()"/"hasgetFrom()" or "__call()" exist and have public access in class "Symfony\Component\Mime\Message".

Example mail-sending code:

        $email = (new TemplatedEmail())
            ->from(new Address('sender@example.com', 'Sender Name'))
            ->to('recipient@example.com')
            ->subject('My Subject')
        ;
        $viewParams = [
            'foo' => 'bar',
            'baz' => 'quux',
        ];
        $text = $this->render('email.txt.twig',$viewParams)->getContent();
        $html = $this->render('email.html.twig',$viewParams)->getContent();
        $email->text($text);
        $email->html($html);
        // I am not using TemplatedEmail's textTemplate() and htmlTemplate() methods because it breaks signing - see https://github.com/symfony/symfony/issues/42407

        $signer = new DkimSigner(pk:'file:///path/to/dkim/key/dkim.key', domainName:'example.com', selector:'sf');

        $signedEmail = $signer->sign($email);

        $mailer->send($signedEmail);

If I use $mailer->send($email); instead (i.e. send the original unsigned email) then the email details show correctly in the Web Profiler.

Possible Solution

No response

Additional Context

No response

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

      0