芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/vendor/laravel/ResendTransport.php
getOriginalMessage()); $envelope = $message->getEnvelope(); $headers = []; $headersToBypass = ['from', 'to', 'cc', 'bcc', 'reply-to', 'sender', 'subject', 'content-type']; foreach ($email->getHeaders()->all() as $name => $header) { if (in_array($name, $headersToBypass, true)) { continue; } $headers[$header->getName()] = $header->getBodyAsString(); } $attachments = []; if ($email->getAttachments()) { foreach ($email->getAttachments() as $attachment) { $headers = $attachment->getPreparedHeaders(); $filename = $headers->getHeaderParameter('Content-Disposition', 'filename'); $item = [ 'content' => str_replace("\r\n", '', $attachment->bodyToString()), 'filename' => $filename, ]; $attachments[] = $item; } } try { $result = $this->resend->emails->send([ 'from' => $envelope->getSender()->toString(), 'to' => $this->stringifyAddresses($this->getRecipients($email, $envelope)), 'cc' => $this->stringifyAddresses($email->getCc()), 'bcc' => $this->stringifyAddresses($email->getBcc()), 'reply_to' => $this->stringifyAddresses($email->getReplyTo()), 'headers' => $headers, 'subject' => $email->getSubject(), 'html' => $email->getHtmlBody(), 'text' => $email->getTextBody(), 'attachments' => $attachments, ]); } catch (Exception $exception) { throw new TransportException( sprintf('Request to Resend API failed. Reason: %s.', $exception->getMessage()), is_int($exception->getCode()) ? $exception->getCode() : 0, $exception ); } $messageId = $result->id; $email->getHeaders()->addHeader('X-Resend-Email-ID', $messageId); } /** * Get the recipients without CC or BCC. */ protected function getRecipients(Email $email, Envelope $envelope): array { return array_filter($envelope->getRecipients(), function (Address $address) use ($email) { return in_array($address, array_merge($email->getCc(), $email->getBcc()), true) === false; }); } /** * Get the string representation of the transport. */ public function __toString(): string { return 'resend'; } }