Skip to content

Commit 0b25519

Browse files
committed
bug #34015 [Mailer] Fix typo (fabpot)
This PR was merged into the 4.4 branch. Discussion ---------- [Mailer] Fix typo | Q | A | ------------- | --- | Branch? | 4.4 for features / 3.4 or 4.3 for bug fixes <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #34006 | License | MIT | Doc PR | n/a The XML is different depending on the way we are sending email. So, it's `SendEmailResult` when using the API and `SendRawEmailResult` when using the HTTP class (we are then sending the raw email). Commits ------- 4bd7cb0368 [Mailer] Fix SES Message Id retrieval
2 parents cade81b + bfb0eeb commit 0b25519

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

Amazon/Transport/SesApiTransport.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
6060
'Date' => $date,
6161
'Content-Type' => 'application/x-www-form-urlencoded',
6262
],
63-
'body' => $this->getPayload($email, $envelope),
63+
'body' => $payload = $this->getPayload($email, $envelope),
6464
]);
6565

6666
$result = new \SimpleXMLElement($response->getContent(false));
6767
if (200 !== $response->getStatusCode()) {
6868
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result->Error->Message, $result->Error->Code), $response);
6969
}
7070

71-
$sentMessage->setMessageId($result->SendEmailResult->MessageId);
71+
$property = $payload['Action'].'Result';
72+
73+
$sentMessage->setMessageId($result->{$property}->MessageId);
7274

7375
return $response;
7476
}

Amazon/Transport/SesHttpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function doSendHttp(SentMessage $message): ResponseInterface
6868
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result->Error->Message, $result->Error->Code), $response);
6969
}
7070

71-
$message->setMessageId($result->SendEmailResult->MessageId);
71+
$message->setMessageId($result->SendRawEmailResult->MessageId);
7272

7373
return $response;
7474
}

SesApiTransport.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
6060
'Date' => $date,
6161
'Content-Type' => 'application/x-www-form-urlencoded',
6262
],
63-
'body' => $this->getPayload($email, $envelope),
63+
'body' => $payload = $this->getPayload($email, $envelope),
6464
]);
6565

6666
$result = new \SimpleXMLElement($response->getContent(false));
6767
if (200 !== $response->getStatusCode()) {
6868
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result->Error->Message, $result->Error->Code), $response);
6969
}
7070

71-
$sentMessage->setMessageId($result->SendEmailResult->MessageId);
71+
$property = $payload['Action'].'Result';
72+
73+
$sentMessage->setMessageId($result->{$property}->MessageId);
7274

7375
return $response;
7476
}

SesHttpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function doSendHttp(SentMessage $message): ResponseInterface
6868
throw new HttpTransportException(sprintf('Unable to send an email: %s (code %s).', $result->Error->Message, $result->Error->Code), $response);
6969
}
7070

71-
$message->setMessageId($result->SendEmailResult->MessageId);
71+
$message->setMessageId($result->SendRawEmailResult->MessageId);
7272

7373
return $response;
7474
}

0 commit comments

Comments
 (0)