add mailjet mailer
This commit is contained in:
parent
96f4de4cf6
commit
d726da1e04
1 changed files with 36 additions and 0 deletions
36
backend/app/Email/MailjetMailer.php
Normal file
36
backend/app/Email/MailjetMailer.php
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Email;
|
||||||
|
|
||||||
|
use Mailjet\Client;
|
||||||
|
use Mailjet\Resources;
|
||||||
|
|
||||||
|
class MailjetMailer implements Emailer
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private Client $mailjet,
|
||||||
|
private string $fromName,
|
||||||
|
) {}
|
||||||
|
public function send(string $from, string $to, string $body): void
|
||||||
|
{
|
||||||
|
$this->mailjet->post(Resources::$Email, [
|
||||||
|
'body' => [
|
||||||
|
'Messages' => [
|
||||||
|
[
|
||||||
|
'From' => [
|
||||||
|
'Email' => $from,
|
||||||
|
'Name' => $this->fromName,
|
||||||
|
],
|
||||||
|
'To' => [
|
||||||
|
[
|
||||||
|
'Email' => $to,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'Subject' => 'TIDE',
|
||||||
|
'TextPart' => $body,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue