You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.0 KiB
PHP

<?php
namespace App\Services\Mail;
use App\Services\Config;
use App\Services\Aws\Factory;
class Ses extends Base
{
protected $client;
public function __construct()
{
$this->client = Factory::createSes();
}
public function getSender()
{
return Config::get('aws_ses_sender');
}
public function send($to, $subject, $text)
{
$this->client->sendEmail([
'Destination' => [ // REQUIRED
'ToAddresses' => [$to],
],
'Message' => [ // REQUIRED
'Body' => [ // REQUIRED
'Html' => [
'Data' => $text, // REQUIRED
],
'Text' => [
'Data' => $text, // REQUIRED
],
],
'Subject' => [ // REQUIRED
'Data' => $subject, // REQUIRED
],
],
'Source' => $this->getSender(), // REQUIRED
]);
}
}