content('Welcome Email', 'Hey there, I just wanted to welcome you!'); $email->send(); // To see the result (boolean) echo $email->result; * */ class Email { /** For checking if the email sent after you use Send() */ public $result = 0; /** Sending Details */ private $_to; private $_from; private $_bcc; /** Content Details */ private $_subject; private $_message; /** * @param $to Who is the email going to? * @param $from Who is the email coming from? (You) */ public function construct($to, $from) { $this->_To = $to; $this->_From = $from; } /** * @param $subject The subject line of the email * @param $message All the contents of the message. */ public function content($subject, $message) { $this->_subject = $subject; $this->_message = $message; } /** * @param $bcc Use CSV format for BCC */ public function bcc($bcc) { $this->_bcc = $bcc; } /** * @desc Sends the email, by default this is sent in HTML format just because it will revert to text * if the users html feature is disabled. */ public function send() { $headers = "From: {$this->_From}" . "\r\n"; $headers .= "Reply-To: {$this->_From}" . "\r\n"; $headers .= "Bcc: {$this->_Bcc}" . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n" ; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n" ; $headers .= 'X-Mailer: PHP/' . phpversion(); if (mail($this->_to, $this->_subject, $this->_message, $headers)) $this->result = 1; } }