sending a mime email using setBody
fails ensureBodyValid
check on send
#59582
Labels
8000
setBody
fails ensureBodyValid
check on send
#59582
Symfony version(s) affected
7.2.1
Description
Using the
Email
class to send mail without using thetext()
andhtml()
methods, but setting the body manually withsetBody()
triggers a validation error on send. theensureBodyValid
method checks for the existence of thehtml
andtext
properties, but fails to see thatsetBody
added the needed parts.How to reproduce
Possible Solution
No response
Additional Context
doing this :
triggers an exception :
which is unexpected. as a workaround, faking the
html
andtext
properties on the Email instance makes it work :I suppose this is because
setBody
is inherited from theMessage
class, and hence does not set the text and html properties on the Email, so this checkfails.
see also in slack : https://symfony-devs.slack.com/archives/C3EQ7S3MJ/p1737557780460529
The text was updated successfully, but these errors were encountered: