-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer][Webhook] Mailtrap webhook support #58403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/Symfony/Component/Mailer/Bridge/Mailtrap/RemoteEvent/MailtrapPayloadConverter.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Mailer\Bridge\Mailtrap\RemoteEvent; | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerDeliveryEvent; | ||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerEngagementEvent; | ||
use Symfony\Component\RemoteEvent\Exception\ParseException; | ||
use Symfony\Component\RemoteEvent\PayloadConverterInterface; | ||
use Symfony\Component\RemoteEvent\RemoteEvent; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
final class MailtrapPayloadConverter implements PayloadConverterInterface | ||
{ | ||
public function convert(array $payload): RemoteEvent | ||
{ | ||
$type = match ($payload['event']) { | ||
'delivery' => MailerDeliveryEvent::DELIVERED, | ||
'open' => MailerEngagementEvent::OPEN, | ||
'click' => MailerEngagementEvent::CLICK, | ||
'unsubscribe' => MailerEngagementEvent::UNSUBSCRIBE, | ||
'spam' => MailerEngagementEvent::SPAM, | ||
'soft bounce', 'bounce' => MailerDeliveryEvent::BOUNCE, | ||
'suspension', 'reject' => MailerDeliveryEvent::DROPPED, | ||
default => throw new ParseException(\sprintf('Unsupported event "%s".', $payload['event'])), | ||
}; | ||
|
||
if (\in_array($type, [MailerDeliveryEvent::DELIVERED, MailerDeliveryEvent::BOUNCE, MailerDeliveryEvent::DROPPED], true)) { | ||
$event = new MailerDeliveryEvent($type, $payload['message_id'], $payload); | ||
$event->setReason($payload['reason'] ?? $payload['response'] ?? ''); | ||
} else { | ||
$event = new MailerEngagementEvent($type, $payload['message_id'], $payload); | ||
} | ||
|
||
if (!$date = \DateTimeImmutable::createFromFormat('U', $payload['timestamp'])) { | ||
throw new ParseException(\sprintf('Invalid date "%s".', $payload['timestamp'])); | ||
} | ||
|
||
$event->setDate($date); | ||
$event->setRecipientEmail($payload['email']); | ||
|
||
if (isset($payload['category'])) { | ||
$event->setTags([$payload['category']]); | ||
} | ||
|
||
if (isset($payload['custom_variables'])) { | ||
$event->setMetadata($payload['custom_variables']); | ||
} | ||
|
||
return $event; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/batch.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "bounce", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000001", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc", | ||
"response": "[CS01] Message rejected due to local policy", | ||
"response_code": 555, | ||
"bounce_category": "spam" | ||
}, | ||
{ | ||
"event": "click", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000002", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc", | ||
"ip": "142.86.27.2", | ||
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36", | ||
"url": "https://mailtrap.io/email-api" | ||
} | ||
] | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/batch.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerDeliveryEvent; | ||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerEngagementEvent; | ||
|
||
$wh1 = new MailerDeliveryEvent(MailerDeliveryEvent::BOUNCE, '00000000-0000-0000-0000-000000000001', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh1->setRecipientEmail('[email protected]'); | ||
$wh1->setTags(['Password reset']); | ||
$wh1->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh1->setReason('[CS01] Message rejected due to local policy'); | ||
$wh1->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
$wh2 = new MailerEngagementEvent(MailerEngagementEvent::CLICK, '00000000-0000-0000-0000-000000000002', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][1]); | ||
$wh2->setRecipientEmail('[email protected]'); | ||
$wh2->setTags(['Password reset']); | ||
$wh2->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh2->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh1, $wh2]; |
19 changes: 19 additions & 0 deletions
19
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/bounce.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "bounce", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000000", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc", | ||
"response": "[CS01] Message rejected due to local policy", | ||
"response_code": 555, | ||
"bounce_category": "spam" | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/bounce.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerDeliveryEvent; | ||
|
||
$wh = new MailerDeliveryEvent(MailerDeliveryEvent::BOUNCE, '00000000-0000-0000-0000-000000000000', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh->setRecipientEmail('[email protected]'); | ||
$wh->setTags(['Password reset']); | ||
$wh->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh->setReason('[CS01] Message rejected due to local policy'); | ||
$wh->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh]; |
19 changes: 19 additions & 0 deletions
19
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/click.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "click", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000000", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc", | ||
"ip": "142.86.27.2", | ||
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36", | ||
"url": "https://mailtrap.io/email-api" | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/click.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerEngagementEvent; | ||
|
||
$wh = new MailerEngagementEvent(MailerEngagementEvent::CLICK, '00000000-0000-0000-0000-000000000000', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh->setRecipientEmail('[email protected]'); | ||
$wh->setTags(['Password reset']); | ||
$wh->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh]; |
16 changes: 16 additions & 0 deletions
16
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/delivery.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "delivery", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000000", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc" | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/delivery.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerDeliveryEvent; | ||
|
||
$wh = new MailerDeliveryEvent(MailerDeliveryEvent::DELIVERED, '00000000-0000-0000-0000-000000000000', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh->setRecipientEmail('[email protected]'); | ||
$wh->setTags(['Password reset']); | ||
$wh->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh->setReason(''); | ||
$wh->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh]; |
18 changes: 18 additions & 0 deletions
18
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/open.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "open", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000000", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc", | ||
"ip": "127.138.158.185", | ||
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36" | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/open.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerEngagementEvent; | ||
|
||
$wh = new MailerEngagementEvent(MailerEngagementEvent::OPEN, '00000000-0000-0000-0000-000000000000', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh->setRecipientEmail('[email protected]'); | ||
$wh->setTags(['Password reset']); | ||
$wh->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh]; |
17 changes: 17 additions & 0 deletions
17
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/reject.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "reject", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000000", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc", | ||
"reason": "Recipient in suppression list. Reason: unsubscription" | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/reject.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerDeliveryEvent; | ||
|
||
$wh = new MailerDeliveryEvent(MailerDeliveryEvent::DROPPED, '00000000-0000-0000-0000-000000000000', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh->setRecipientEmail('[email protected]'); | ||
$wh->setTags(['Password reset']); | ||
$wh->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh->setReason('Recipient in suppression list. Reason: unsubscription'); | ||
$wh->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh]; |
19 changes: 19 additions & 0 deletions
19
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/soft_bounce.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "soft bounce", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000000", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc", | ||
"response": "4.7.1 Temporary error, please retry", | ||
"response_code": 451, | ||
"bounce_category": "greylisting" | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/soft_bounce.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerDeliveryEvent; | ||
|
||
$wh = new MailerDeliveryEvent(MailerDeliveryEvent::BOUNCE, '00000000-0000-0000-0000-000000000000', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh->setRecipientEmail('[email protected]'); | ||
$wh->setTags(['Password reset']); | ||
$wh->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh->setReason('4.7.1 Temporary error, please retry'); | ||
$wh->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh]; |
16 changes: 16 additions & 0 deletions
16
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/spam.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "spam", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000000", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc" | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/spam.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerEngagementEvent; | ||
|
||
$wh = new MailerEngagementEvent(MailerEngagementEvent::SPAM, '00000000-0000-0000-0000-000000000000', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh->setRecipientEmail('[email protected]'); | ||
$wh->setTags(['Password reset']); | ||
$wh->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh]; |
17 changes: 17 additions & 0 deletions
17
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/suspension.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"event": "suspension", | ||
"category": "Password reset", | ||
"custom_variables": { | ||
"variable_a": "value", | ||
"variable_b": "value2" | ||
}, | ||
"message_id": "00000000-0000-0000-0000-000000000000", | ||
"email": "[email protected]", | ||
"timestamp": 1726358034, | ||
"event_id": "bede7236-2284-43d6-a953-1fdcafd0fdbc", | ||
"reason": "Your account has reached its daily sending limit." | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Symfony/Component/Mailer/Bridge/Mailtrap/Tests/Webhook/Fixtures/suspension.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
use Symfony\Component\RemoteEvent\Event\Mailer\MailerDeliveryEvent; | ||
|
||
$wh = new MailerDeliveryEvent(MailerDeliveryEvent::DROPPED, '00000000-0000-0000-0000-000000000000', json_decode(file_get_contents(str_replace('.php', '.json', __FILE__)), true)['events'][0]); | ||
$wh->setRecipientEmail('[email protected]'); | ||
$wh->setTags(['Password reset']); | ||
$wh->setMetadata(['variable_a' => 'value', 'variable_b' => 'value2']); | ||
$wh->setReason('Your account has reached its daily sending limit.'); | ||
$wh->setDate(\DateTimeImmutable::createFromFormat('U', 1726358034)); | ||
|
||
return [$wh]; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.