152 $separator = md5(time());
158 $this->header =
"From: " . $this->
from . $eol;
159 $this->header .=
"MIME-Version: 1.0" . $eol;
161 if ($this->format ==
'PLAIN')
163 $this->header .=
"Content-Type: multipart/mixed; boundary=\"" . $separator .
"\"" ;
165 $this->
content .=
"--" . $separator . $eol;
166 $this->
content .=
"Content-Type: text/plain; charset=UTF-8" . $eol;
167 $this->
content .=
"Content-Transfer-Encoding: 8bit" . $eol.$eol ;
168 $this->
content .= $this->message . $eol ;
169 }
elseif ($this->format ==
'HTML') {
170 $separator_second=md5(rand());
172 $this->header .=
"Content-Type: multipart/mixed; boundary=\"" . $separator .
"\"" .$eol ;
174 $this->
content .=
"--" . $separator . $eol;
175 $this->
content .=
"Content-Type: multipart/alternative; boundary=\"" . $separator_second .
"\"".$eol ;
176 $this->
content.=
"--$separator_second".$eol;
177 $this->
content .=
"Content-Type: text/plain; charset=UTF-8; format=flowed".$eol;
178 $this->
content .=
"Content-Transfer-Encoding: 8bit" . $eol.$eol ;
179 $this->
content .= strip_tags($this->message) . $eol ;
184 $this->
content .=
"--" . $separator_second.$eol;
185 $this->
content .=
"Content-Type: text/html; charset=UTF-8" . $eol;
186 $this->
content .=
"Content-Transfer-Encoding: 8bit" . $eol.$eol ;
192<meta http-equiv=
"content-type" content=
"text/html; charset=UTF-8">{$eol}
199 $this->
content .= $this->message. $eol ;
200 $this->
content .=
" </body> </html>".$eol;
201 $this->
content .=
"--" . $separator_second.
"--" . $eol;
204 throw new \Exception(
'SC172 : unknow format ');
207 if ( ! empty($this->afile ) )
210 for (
$i = 0;
$i < count($this->afile);
$i++)
214 $file_size = filesize(
$file->full_name);
215 $mimetype=(
$file->type==
"")?mime_content_type(
$file->full_name):
$file->type;
216 $handle = fopen(
$file->full_name,
"r");
217 if ( $handle ==
false ){
219 throw new Exception (
'SC159 email not send file not added'.
$file->full_name);
221 $content = fread($handle, $file_size);
224 $this->
content .=
"--" . $separator . $eol;
225 $this->
content .=
"Content-Type: " . $mimetype .
"; name=\"" .
$file->filename .
"\"" . $eol;
226 $this->
content .=
"Content-Disposition: attachment; filename=\"" .
$file->filename .
"\"" . $eol;
227 $this->
content .=
"Content-Transfer-Encoding: base64" . $eol;
232 if ( empty ($this->afile) ) $this->
content.=$eol;
234 $this->
content .=
"--" . $separator .
"--";