TIDE/backend/app/Email/MailjetMailer.php
2026-05-11 10:37:45 +03:00

36 lines
929 B
PHP

<?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,
],
],
],
]);
}
}