/* sendMail Class - by Andr? Cupini - andre@neobiz.com.br */ /* Modifie by object.live@hotmail.com */ class sendMail { var $to; var $cc; var $bcc; var $subject; var $from; var $headers; var $html; var $body; var $dear; function sendMail() { $this->to = NULL; $this->cc = NULL; $this->bcc = NULL; $this->subject = NULL; $this->from = NULL; $this->headers = NULL; $this->html = TRUE; $this->body = NULL; $this->dear = NULL; } function getParams($params) { $i = 0; foreach ($params as $key => $value) { switch($key) { case 'to': $this->to = $value; break; case 'cc': $this->cc = $value; break; case 'bcc': $this->bcc = $value; break; case 'subject': $this->subject = $value; break; case 'from': $this->from = $value; break; case 'submitted': NULL; break; default: $this->body[$i]["key"] = str_replace("_", " ", ucWords(strToLower($key))); $this->body[$i++]["value"] = $value; } } } function setHeaders() { $this->headers = "From: ".$this->from."\r\n"; if($this->html === TRUE) { $this->headers.= "MIME-Version: 1.0\r\n"; $this->headers.= "Content-type: text/html; charset=UTF-8\r\n"; } if(!empty($this->cc)) $this->headers.= "Cc: ".$this->cc."\r\n"; if(!empty($this->bcc)) $this->headers.= "Bcc: ".$this->bcc."\r\n"; } function parseBody() { $count = count($this->body); for($i = 0; $i < $count; $i++) { if($this->html) $content.= ""; $content .= $this->body[$i]["key"].': '; if($this->html) $content.= ""; if($this->html) $content .= nl2br($this->body[$i]["value"])."\n"; else $content .= $this->body[$i]["value"]; if($this->html) $content.= "