Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions src/Endpoints/EmailEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@ public function metadata(array $metadata): self
return $this;
}

/**
* Set the tag of the email.
*
* @param string|null $tag The tag formatted as slug
*/
public function tag(?string $tag): self
{
$this->payload['tag'] = $tag;

return $this;
}

/**
* Send the composed email using the current payload.
*
Expand Down
20 changes: 20 additions & 0 deletions tests/Endpoints/EmailEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,23 @@
->metadata(['foo' => 'bar'])
->send();
});

test('it handles tags', function () {
$this->httpClient
->shouldReceive('post')
->once()
->with('/v1/send', [
'from' => 'sender@example.com',
'to' => ['recipient@example.com'],
'subject' => 'Test Subject',
'tag' => 'campaign',
], [])
->andReturn(['message_id' => '123', 'status' => 'pending']);

$this->endpoint
->from('sender@example.com')
->to('recipient@example.com')
->subject('Test Subject')
->tag('campaign')
->send();
});
Loading