18 protected $charset=
'UTF-8';
19 protected $ctype=
'text/html';
26 public function to($to)
35 public function from($from)
53 public function html($bool=
true)
57 $this->ctype =
'text/html';
61 $this->ctype =
'text/plain';
69 public function text($bool=
true)
73 $this->ctype =
'text/plain';
77 $this->ctype =
'text/html';
84 private function head()
86 $this->head[]=
'MIME-Version: 1.0';
87 $this->head[]=
'Content-type: '.$this->ctype.
'; charset='.$this->charset;
88 $this->head[]=
'From: '.$this->from;
89 $this->head[]=
'Reply-To: '.$this->from;
90 $this->head[]=
'X-Mailer: PHP/'.phpversion();
91 return implode(
"\r\n",$this->head);
98 public function body($content)
100 $this->
body[] = $content;
110 if((filter_var($this->
from, FILTER_VALIDATE_EMAIL))&&(filter_var($this->
to, FILTER_VALIDATE_EMAIL)))
112 return mail(
''.$this->
to.
'',$this->subject,implode(PHP_EOL,$this->
body),implode(
"\r\n",$this->head));
127 $b = implode(PHP_EOL,$this->
body);