Open jeremyVignelles opened 5 days ago
Hey Jeremy,
If toString()
method does not work, how does that test pass in this repo? And actually, I would suppose that the raw text body contained the line breaks as well, no? Why toString()
would add those line breaks? Or am I missing something?
Hi, My assumption is that toString() formats the message as it would be sent over the wire, with the target chunking and encoding (multipart/mixed), while the textBody doesn't have that limitation, it's just the raw text as it is intended.
I assume the =\n
part to be because of the multipart encoding that truncates the lines to a maximum length.
I don't know why, and maybe that's a misconfiguration in my case ? Or maybe it's because I'm using the messenger component to send the message asynchronously ?
Seems like toString() calls Email::GenerateBody, which in turn creates a TextPart, which uses quoted-printable as the encoding.
The encoder calls the native quoted_printable_encode
PHP function which truncates lines to 75 characters as specified by the RFC. The corresponding source code of PHP can be found here.
That being said, that doesn't explain how tests can pass in this repo (spoiler: I didn't look at them yet).
Version: 1.22.0
I used the maker bundle to generate tests for the password reset feature. I adapted the code so that the mail is in french, but the generated code fails to properly get the token
Test method excerpt:
$email value excerpt:
Notice how the link is split in two lines. In that case, only
qsfTOThd0P
matches as the token, which throws an InvalidResetPasswordTokenException because the length is not 40 inResetPasswordHelper::validateTokenAndFetchUser
Workaround:
instead of getting
toString()
of a templated message, we can get the raw text body, that doesn't have the formatting issue.