You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use DkimSigner to sign an email and send it, the web profiler's "Emails" page fails to load.
How to reproduce
create a new TemplatedEmail()
sign the email using DkimSigner
send the signed email
open the web profiler for the request
access the "Emails" page
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
The text was updated successfully, but these errors were encountered:
This PR was merged into the 5.4 branch.
Discussion
----------
[Mailer] Fix signed emails breaking the profiler
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#53928
| License | MIT
Commits
-------
b202d65 [Mailer] Fix signed emails breaking the profiler
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
new TemplatedEmail()
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:
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
The text was updated successfully, but these errors were encountered: