/ Published in: PHP
Just a simple wrapper class that makes sure mail doesn't get sent out when the constant DEBUG_MODE is set to true
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<? class SystemEmail { var $_to; var $_subject; var $_message; function SystemEmail($to, $subject, $message, $from = false) { $this->_to = $to; $this->_subject = $subject; $this->_message = $message; if ($from) { $this->_additional_headers[] = $from; } } function set_html() { $this->_additional_headers[] = 'MIME-Version: 1.0' . " "; $this->_additional_headers[] = 'Content-type: text/html; charset=iso-8859-1' . " "; } function send() { $headers = ""; { foreach ($this->_additional_headers as $header) { $headers .= $header; } } if (DEBUG_MODE) { $this->_to = ADMIN_EMAIL; } } } ?>