59 $this->
from = $p_from;
68 $this->subject = $p_subject;
87 $this->message =$p_message;
96 $this->afile[] =
$file;
105 $array = explode(
",",
"from,subject,mailto,message");
109 if (trim($this->
$name??
"") ==
"")
135 $separator = md5(time());
141 $this->header =
"From: " . $this->
from . $eol;
142 $this->header .=
"MIME-Version: 1.0" . $eol;
144 $this->header .=
"Content-Type: multipart/mixed; boundary=\"" . $separator .
"\"" ;
147 $this->
content .=
"--" . $separator . $eol;
148 $this->
content .=
"Content-Type: text/plain; charset=\"utf-8\"" . $eol;
149 $this->
content .=
"Content-Transfer-Encoding: 7bit" . $eol.$eol ;
150 $this->
content .= $this->message . $eol ;
151 if ( ! empty($this->afile ) )
154 for (
$i = 0;
$i < count($this->afile);
$i++)
158 $file_size = filesize(
$file->full_name);
159 $handle = fopen(
$file->full_name,
"r");
160 if ( $handle ==
false ){
162 throw new Exception (
'SC159 email not send file not added'.
$file->full_name);
164 $content = fread($handle, $file_size);
167 $this->
content .=
"--" . $separator . $eol;
168 $this->
content .=
"Content-Type: " .
$file->type .
"; name=\"" .
$file->filename .
"\"" . $eol;
169 $this->
content .=
"Content-Disposition: attachment; filename=\"" .
$file->filename .
"\"" . $eol;
170 $this->
content .=
"Content-Transfer-Encoding: base64" . $eol;
175 if ( empty ($this->afile) ) $this->
content.=$eol;
177 $this->
content .=
"--" . $separator .
"--";
189 }
catch (Exception
$e) {
193 if (!mail($this->
mailto, $this->subject, $this->
content,$this->header))
195 throw new Exception(
'send failed');
record_log($p_message)
Record an error message into the log file of the server.
else $card content[$j]['j_montant']
compose()
create the message before sending
add_supplemental_header()
Function to override if supplemental header are needed.
mailto($p_mailto)
set the recipient
verify()
verify that the message is ready to go
add_file(FileToSend $file)
Add file to the message.
set_message($p_message)
body of the message (utf8)
set_from($p_from)
set the from