Skip to content

Instantly share code, notes, and snippets.

@wonzbak
Created March 16, 2018 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wonzbak/51085576588ccdea4174ed81e01c27d2 to your computer and use it in GitHub Desktop.
Save wonzbak/51085576588ccdea4174ed81e01c27d2 to your computer and use it in GitHub Desktop.
Mailer High level class
<?php
namespace Mail;
/**
* Class Mailer
*
* Class to send email.
*
*/
class Mailer
{
private $from;
private $subject;
private $to;
private $toCc;
private $toBcc;
private $content;
private $htmlContent;
private $filenames;
private $mailer;
public function __construct($mailer)
{
$this->mailer = $mailer;
$this->from = [];
$this->subject = "";
$this->to = [];
$this->toCC = [];
$this->toBcc = [];
$this->files = [];
}
public function from($address, $name)
{
$this->from[] = [$address, $name];
return $this;
}
public function subject($subject)
{
$this->subject = $subject;
return $this;
}
public function to($address, $name = null)
{
$this->to[] = [$address, $name];
return $this;
}
public function toCc($address, $name = null)
{
$this->toCc[] = [$address, $name];
return $this;
}
public function toBcc($address, $name = null)
{
$this->toBc[] = [$address, $name];
return $this;
}
public function content($content)
{
$this->content = $content;
return $this;
}
public function htmlContent($htmlContent)
{
$this->htmlContent = $htmlContent;
return $this;
}
public function attachFile($filename)
{
$this->filenames[] = $filename;
}
public function send()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment