Skip to content

[Mailer] Incorrect Header in profiler #45758

Closed
@raziel057

Description

@raziel057

Symfony version(s) affected

4.4.x

Description

The header data (Date, Message-ID, Content-Type) displayed in the Profiler is not the one of the sent message, but is refreshed each time the profiler page is reloaded.

You can see here each time I refresh the profiler page, the Header data is modified. It's not the case with Swiftmailer profile.

Ex for same email:
image

After page refresh the profiler tab:
image

The issue is related to the following code (getPreparedHeaders):

<div class="tab">
    <h3 class="tab-title">Raw</h3>
    <div class="tab-content">
        <pre class="prewrap" style="max-height: 600px">{{ message.toString() }}</pre>
    </div>
</div>
public function toString(): string
{
   if (null === $body = $this->getBody()) {
       $body = new TextPart('');
   }

   return $this->getPreparedHeaders()->toString().$body->toString();
}

How to reproduce

Send an email, go to the profiler page and refresh the profiler.

Check that headers change (Date takes the current datetime)

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