Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Adapters/PostalAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use DomainException;
use Illuminate\Support\Arr;
use Postal\Client;
use Postal\SendMessage;
use Postal\Send\Message;
use Sendportal\Base\Services\Messages\MessageTrackingOptions;

class PostalAdapter extends BaseMailAdapter
Expand All @@ -20,12 +20,12 @@ public function send(string $fromEmail, string $fromName, string $toEmail, strin
{
$client = new Client('https://' . Arr::get($this->config, 'postal_host'), Arr::get($this->config, 'key'));

$message = new SendMessage($client);
$message = new Message($client);
$message->to($toEmail);
$message->from($fromName.' <'.$fromEmail.'>');
$message->subject($subject);
$message->htmlBody($content);
$response = $message->send();
$response = $client->send->message($message);

return $this->resolveMessageId($response);
}
Expand All @@ -35,7 +35,7 @@ public function send(string $fromEmail, string $fromName, string $toEmail, strin
protected function resolveMessageId($response): string
{
foreach ($response->recipients() as $email => $message) {
return (string) $message->id();
return (string) $message->id;
}

throw new DomainException('Unable to resolve message ID');
Expand Down