create email and emailer with tests

This commit is contained in:
Yisroel Baum 2025-11-17 20:45:32 +02:00
parent 86787b7d3f
commit 962614ea02
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
4 changed files with 168 additions and 0 deletions

73
src/Email/Email.php Normal file
View file

@ -0,0 +1,73 @@
<?php
namespace FreightQuote\Email;
class Email
{
private array $recipients = [];
private array $cc = [];
private array $bcc = [];
private string $subject = '';
private string $body = '';
private array $fileAttachments = [];
public function addRecipient(string $email): void
{
$this->recipients[] = $email;
}
public function getRecipients(): array
{
return $this->recipients;
}
public function addCC(string $email): void
{
$this->cc[] = $email;
}
public function getCC(): array
{
return $this->cc;
}
public function addBCC(string $email): void
{
$this->bcc[] = $email;
}
public function getBCC(): array
{
return $this->bcc;
}
public function setSubject(string $subject): void
{
$this->subject = $subject;
}
public function getSubject(): string
{
return $this->subject;
}
public function setBody(string $body): void
{
$this->body = $body;
}
public function getBody(): string
{
return $this->body;
}
public function addAttachment(string $path): void
{
$this->fileAttachments[] = $path;
}
public function getAttachments(): array
{
return $this->fileAttachments;
}
}

10
src/Email/Emailer.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace FreightQuote\Email;
interface Emailer
{
public function send(Email $email): bool;
}