Skip to content

Laravel 10 mailer failover inline image crackd. when the first mail send fail #51872

@137-rick

Description

@137-rick

Laravel Version

10.48.12

PHP Version

8.3.6

Database Driver & Version

No response

Description

config/mail.php

'failover' => [
'transport' => 'failover',
'mailers' => [
'mailgun',
'ses',
],
],

the rest is email source

normal email will got
Content-Type: multipart/related; boundary=xxx

broken email will got
Content-Type: multipart/mixed; boundary=xxx


normal email image path is
cid:d3a788f4cbf3a6aab32dcacde69a2e34@symfony

and the email raw about attachment
Content-ID: d3a788f4cbf3a6aab32dcacde69a2e34@symfony
Content-Type: image/png; name="d3a788f4cbf3a6aab32dcacde69a2e34@symfony"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
name="d3a788f4cbf3a6aab32dcacde69a2e34@symfony"; filename=V9J4rKBvmB

broken email will got path is
cid:L7HALxfBwi

and the email raw about attachment
Content-ID: 2eabc9240b3557c72ad65e92a60f7f57@symfony
Content-Type: image/png; name="2eabc9240b3557c72ad65e92a60f7f57@symfony"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
name="2eabc9240b3557c72ad65e92a60f7f57@symfony"; filename=L7HALxfBwi

Steps To Reproduce

send mail with mailable with view of html (blade)

when i change this path code with deep copy it's worked

path: vendor/symfony/mailer/Transport/RoundRobinTransport.php

`
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
{
$exception = null;

while ($transport = $this->getNextTransport()) {
    try {
        $currentMessage = deep_copy($message); //here 
        return $transport->send($currentMessage, Envelope::create($currentMessage)); //here 
    } catch (TransportExceptionInterface $e) {
        $exception ??= new TransportException('All transports failed.');
        $exception->appendDebug(sprintf("Transport \"%s\": %s\n", $transport, $e->getDebug()));
        $this->deadTransports[$transport] = microtime(true);
    }
}

throw $exception ?? new TransportException('No transports found.');

}`
that may the mailgun modify the $message attchement property, and inface the symfony use clone but not deep copy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions