Skip to content

Commit

Permalink
improve debug infos
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed Jun 21, 2024
1 parent 3220be4 commit c9ee240
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/SparkPostApiTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
$result = [
'total_rejected_recipients' => 0,
'total_accepted_recipients' => count($to),
'id' => uniqid(),
'id' => 'fake-' . uniqid(),
'disabled' => true,
];
} else {
Expand Down Expand Up @@ -402,12 +402,16 @@ protected function logMessageContent(Email $message, $results = [])
$emailHeaders = $message->getHeaders();

// Append some extra information at the end
$logContent .= '<pre>Debug infos:' . "\n\n";
$logContent .= 'To : ' . EmailUtils::stringifyArray($message->getTo()) . "\n";
$logContent .= 'Subject : ' . $subject . "\n";
$logContent .= 'From : ' . EmailUtils::stringifyArray($message->getFrom()) . "\n";
$logContent .= 'Headers:' . "\n" . $emailHeaders->toString() . "\n";
$logContent .= 'Results:' . "\n";
$logContent .= '<pre>Headers:' . "\n\n";
$logContent .= $emailHeaders->toString();

// Store subsite
if (class_exists(\SilverStripe\Subsites\Model\Subsite::class)) {
$state = \SilverStripe\Subsites\State\SubsiteState::singleton();
$logContent .= "Subsite ID: " . $state->getSubsiteId() . "\n";
}

$logContent .= "\n" . 'Results:' . "\n";
$logContent .= print_r($results, true) . "\n";
$logContent .= '</pre>';

Expand Down

0 comments on commit c9ee240

Please sign in to comment.