Below is a Mail class I created in PHP, it requires 4 arguments on initiation of the class via the constructor and uses the method ->send() to send the created mail once complete.

[code lang=”php”]

class Mail {
var $to;
var $subject;
var $content;
var $headers;

function Mail($to, $subject, $content, $from){

$this->to = $to;
$this->subject = $subject;
$this->content = $content;
$this->headers = “Content-type: text/html; charset=iso-8859-1\r\nFrom: $from”;

$this->content = ““.$content.”“;
}

function send(){
return mail($this->to, $this->subject, stripslashes($this->content), $this->headers);
}
}

[/code]


Leave a Reply

Your email address will not be published. Required fields are marked *