diff --git a/README.md b/README.md index d745b630..b4e2e8ac 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ $messaging->send($message); - [ ] [Postmark](https://postmarkapp.com/) - [ ] [SparkPost](https://www.sparkpost.com/) - [ ] [SendinBlue](https://www.sendinblue.com/) -- [ ] [MailSlurp](https://www.mailslurp.com/) +- [x] [MailSlurp](https://www.mailslurp.com/) - [ ] [ElasticEmail](https://elasticemail.com/) - [ ] [SES](https://aws.amazon.com/ses/) diff --git a/src/Utopia/Messaging/Adapters/Email/MailSlurp.php b/src/Utopia/Messaging/Adapters/Email/MailSlurp.php new file mode 100644 index 00000000..1d2f6d8c --- /dev/null +++ b/src/Utopia/Messaging/Adapters/Email/MailSlurp.php @@ -0,0 +1,68 @@ +inboxId !== null) { + $url .= '?inboxId='.$this->inboxId; + } + return $this->request( + method: 'POST', + url: $url, + headers: [ + 'x-api-key: '.$this->apiKey, + 'Content-Type: application/json', + ], + body: \json_encode([ + 'to' => $message->getTo(), + 'from' => $message->getFrom(), + 'subject' => $message->getSubject(), + 'text' => $message->getContent(), + 'html' => $message->isHtml(), + ]), + ); + } +} diff --git a/tests/e2e/Email/MailSlurpTest.php b/tests/e2e/Email/MailSlurpTest.php new file mode 100644 index 00000000..d5d9c6fa --- /dev/null +++ b/tests/e2e/Email/MailSlurpTest.php @@ -0,0 +1,34 @@ +send($message); + $this->assertEquals($response, ''); + } +}