Created
March 16, 2018 16:19
-
-
Save wonzbak/51085576588ccdea4174ed81e01c27d2 to your computer and use it in GitHub Desktop.
Mailer High level class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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