-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't access to html body of the email #58
Comments
Hi @clemcoder! I'm wondering if it is there but during serialization, it is lost from dd($email->getBody()->toString()); Do you see the html?
I recommend checking out zenstruck/mailer-test. This provides email-related assertions and supports queued emails. |
It outputs "Symfony\Component\Mime\Exception\LogicException: A message must have a text or an HTML part or attachments.". I didn't know about zenstruck/mailer-test, I'll take a look. Thanks for your help. |
Oh! You'll need to process the queue before you can see the html. I think the following will work: $asyncMessengerTransport = $this->messenger('async');
$asyncMessengerTransport->queue()->assertCount(1);
$asyncMessengerTransport->process();
$firstMessage = $asyncMessengerTransport->acknowledged()->first()->getMessage();
$email = $firstMessage->getMessage();
$htmlBody = $email->getHtmlBody(); |
Nop, unfortunately already tried. |
Hmm ok, I guess processing the email doesn't manipulate the message. At the end of the day I believe this makes sense and is expected. I guess you can't use messenger-test to test the processing of emails. |
Hello,
I try to test the html content of an email (I want to check a particular link inside).
Here is the code :
Unfortunately getHtmlBody always returns null.
Is there a probleme in this code ?
Is it possible to test the content of the email ?
Thanks.
The text was updated successfully, but these errors were encountered: