23 if (!class_exists(
'SMTP5')) require_once
'SMTP5.php';
53 public $QMail =
'/var/qmail/bin/sendmail';
55 private $_conns = array();
60 $this->_result(array(0 =>
'initialize class'));
63 private function _result($data = array(), $ret = null) {
64 $this->History[][strval(microtime(
true))] = $data;
65 $this->Result = $data;
69 public function context($arr = null, $debug = null) {
71 if (!is_array($arr))
FUNC5::trace($debug,
'invalid context type');
72 else if (!is_resource($res = stream_context_create($arr)))
FUNC5::trace($debug,
'invalid context value');
74 $this->Context = $res;
75 return $this->_result(array(0 =>
'set context connection'),
true);
79 public function name($host = null, $debug = null) {
81 if (!is_string($host))
FUNC5::trace($debug,
'invalid hostname type');
83 $host = strtolower(trim($host));
86 return $this->_result(array(0 =>
'set HELO/EHLO hostname'),
true);
90 public function path($addr = null, $debug = null) {
92 if (!is_string($addr))
FUNC5::trace($debug,
'invalid address type');
96 return $this->_result(array(0 =>
'set Return-Path address'),
true);
100 public function priority($level = null, $debug = null) {
102 if ($level == null) {
103 $this->Priority = null;
104 return $this->_result(array(0 =>
'unset priority'),
true);
105 }
else if (is_int($level) || is_string($level)) {
107 if ($level == 1 || $level == 3 || $level == 5 || $level ==
'high' || $level ==
'normal' || $level ==
'low') {
108 $this->Priority = $level;
109 return $this->_result(array(0 =>
'set priority'),
true);
114 public function from($addr = null, $name = null, $charset = null, $encoding = null, $debug = null) {
117 if (!is_string($addr)) $err[] =
'invalid address type';
118 else if (!
FUNC5::is_mail($addr)) $err[] =
'invalid address value';
120 if (!is_string($name)) $err[] =
'invalid name type';
123 if ($name ==
'') $err[] =
'invalid name value';
126 if ($charset != null) {
127 if (!is_string($charset)) $err[] =
'invalid charset type';
128 else if (!(strlen($charset) >= 2 &&
FUNC5::is_alpha($charset,
true,
'-'))) $err[] =
'invalid charset value';
130 if ($encoding != null) {
131 if (!is_string($encoding)) $err[] =
'invalid encoding type';
133 $encoding = strtolower($encoding);
134 if (!isset(
MIME5::$hencarr[$encoding])) $err[] =
'invalid encoding value';
137 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
139 $this->From = array(
'address' => $addr,
'name' => $name,
'charset' => $charset,
'encoding' => $encoding);
140 return $this->_result(array(0 =>
'set From address'),
true);
144 public function addto($addr = null, $name = null, $charset = null, $encoding = null, $debug = null) {
147 if (!is_string($addr)) $err[] =
'invalid address type';
148 else if (!
FUNC5::is_mail($addr)) $err[] =
'invalid address value';
150 if (!is_string($name)) $err[] =
'invalid name type';
153 if ($name ==
'') $err[] =
'invalid name value';
156 if ($charset != null) {
157 if (!is_string($charset)) $err[] =
'invalid charset type';
158 else if (!(strlen($charset) >= 2 &&
FUNC5::is_alpha($charset,
true,
'-'))) $err[] =
'invalid charset value';
160 if ($encoding != null) {
161 if (!is_string($encoding)) $err[] =
'invalid encoding type';
163 $encoding = strtolower($encoding);
164 if (!isset(
MIME5::$hencarr[$encoding])) $err[] =
'invalid encoding value';
167 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
170 if (count($this->To) > 0) {
171 $ladr = strtolower($addr);
172 foreach ($this->To as
$to) {
173 if ($ladr == strtolower($to[
'address'])) {
174 FUNC5::trace($debug,
'duplicate To address "'.$addr.
'"', 1);
179 if ($find)
return false;
181 $this->To[] = array(
'address' => $addr,
'name' => $name,
'charset' => $charset,
'encoding' => $encoding);
182 return $this->_result(array(0 =>
'add To address'),
true);
187 public function delto($addr = null, $debug = null) {
191 return $this->_result(array(0 =>
'delete all To addresses'),
true);
197 if (count($this->To) > 0) {
198 $addr = strtolower($addr);
199 foreach ($this->To as
$to) {
200 if ($addr == strtolower($to[
'address'])) $ret =
true;
206 return $this->_result(array(0 =>
'delete To address'),
true);
207 }
else return FUNC5::trace($debug,
'To address "'.$addr.
'" not found', 1);
211 public function addcc($addr = null, $name = null, $charset = null, $encoding = null, $debug = null) {
214 if (!is_string($addr)) $err[] =
'invalid address type';
215 else if (!
FUNC5::is_mail($addr)) $err[] =
'invalid address value';
217 if (!is_string($name)) $err[] =
'invalid name type';
220 if ($name ==
'') $err[] =
'invalid name value';
223 if ($charset != null) {
224 if (!is_string($charset)) $err[] =
'invalid charset type';
225 else if (!(strlen($charset) >= 2 &&
FUNC5::is_alpha($charset,
true,
'-'))) $err[] =
'invalid charset value';
227 if ($encoding != null) {
228 if (!is_string($encoding)) $err[] =
'invalid encoding type';
230 $encoding = strtolower($encoding);
231 if (!isset(
MIME5::$hencarr[$encoding])) $err[] =
'invalid encoding value';
234 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
237 if (count($this->Cc) > 0) {
238 $ladr = strtolower($addr);
239 foreach ($this->Cc as $cc) {
240 if ($ladr == strtolower($cc[
'address'])) {
241 FUNC5::trace($debug,
'duplicate Cc address "'.$addr.
'"', 1);
246 if ($find)
return false;
248 $this->Cc[] = array(
'address' => $addr,
'name' => $name,
'charset' => $charset,
'encoding' => $encoding);
249 return $this->_result(array(0 =>
'add Cc address'),
true);
254 public function delcc($addr = null, $debug = null) {
258 return $this->_result(array(0 =>
'delete all Cc addresses'),
true);
264 if (count($this->Cc) > 0) {
265 $addr = strtolower($addr);
266 foreach ($this->Cc as $cc) {
267 if ($addr == strtolower($cc[
'address'])) $ret =
true;
273 return $this->_result(array(0 =>
'delete Cc address'),
true);
274 }
else return FUNC5::trace($debug,
'Cc address "'.$addr.
'" not found', 1);
278 public function addbcc($addr = null, $debug = null) {
280 if (!is_string($addr))
FUNC5::trace($debug,
'invalid address type');
283 if (count($this->Bcc) > 0) {
284 $ladr = strtolower($addr);
285 foreach ($this->Bcc as $bcc) {
286 if ($ladr == strtolower($bcc)) {
287 FUNC5::trace($debug,
'duplicate Bcc address "'.$addr.
'"', 1);
292 if ($find)
return false;
294 $this->Bcc[] = $addr;
295 return $this->_result(array(0 =>
'add Bcc address'),
true);
299 public function delbcc($addr = null, $debug = null) {
302 $this->Bcc = array();
303 return $this->_result(array(0 =>
'delete all Bcc addresses'),
true);
309 if (count($this->Bcc) > 0) {
310 $addr = strtolower($addr);
311 foreach ($this->Bcc as $bcc) {
312 if ($addr == strtolower($bcc)) $ret =
true;
318 return $this->_result(array(0 =>
'delete Bcc address'),
true);
319 }
else return FUNC5::trace($debug,
'Bcc address "'.$addr.
'" not found', 1);
323 public function addheader($name = null, $value = null, $charset = null, $encoding = null, $debug = null) {
326 if (!is_string($name)) $err[] =
'invalid name type';
329 if (!(strlen($name) >= 2 &&
FUNC5::is_alpha($name,
true,
'-'))) $err[] =
'invalid name value';
331 if (!is_string($value)) $err[] =
'invalid content type';
334 if ($value ==
'') $err[] =
'invalid content value';
336 if ($charset != null) {
337 if (!is_string($charset)) $err[] =
'invalid charset type';
338 else if (!(strlen($charset) >= 2 &&
FUNC5::is_alpha($charset,
true,
'-'))) $err[] =
'invalid charset value';
340 if ($encoding != null) {
341 if (!is_string($encoding)) $err[] =
'invalid encoding type';
343 $encoding = strtolower($encoding);
344 if (!isset(
MIME5::$hencarr[$encoding])) $err[] =
'invalid encoding value';
347 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
349 $ver = strtolower($name);
351 if ($ver ==
'to') $err =
'can not set "To", for this, use function "AddTo()"';
352 else if ($ver ==
'cc') $err =
'can not set "Cc", for this, use function "AddCc()"';
353 else if ($ver ==
'bcc') $err =
'can not set "Bcc", for this, use function "AddBcc()"';
354 else if ($ver ==
'from') $err =
'can not set "From", for this, use function "From()"';
355 else if ($ver ==
'subject') $err =
'can not set "Subject", for this, use function "Subject()"';
356 else if ($ver ==
'x-priority') $err =
'can not set "X-Priority", for this, use function "Priority()"';
357 else if ($ver ==
'x-msmail-priority') $err =
'can not set "X-MSMail-Priority", for this, use function "Priority()"';
358 else if ($ver ==
'x-mimeole') $err =
'can not set "X-MimeOLE", for this, use function "Priority()"';
359 else if ($ver ==
'date') $err =
'can not set "Date", this value is automaticaly set';
360 else if ($ver ==
'content-type') $err =
'can not set "Content-Type", this value is automaticaly set';
361 else if ($ver ==
'content-transfer-encoding') $err =
'can not set "Content-Transfer-Encoding", this value is automaticaly set';
362 else if ($ver ==
'content-disposition') $err =
'can not set "Content-Disposition", this value is automaticaly set';
363 else if ($ver ==
'mime-version') $err =
'can not set "Mime-Version", this value is automaticaly set';
364 else if ($ver ==
'x-mailer') $err =
'can not set "X-Mailer", this value is automaticaly set';
365 else if ($ver ==
'message-id') $err =
'can not set "Message-ID", this value is automaticaly set';
368 $this->Header[] = array(
'name' => $name,
'value' => $value,
'charset' => $charset,
'encoding' => $encoding);
369 return $this->_result(array(0 =>
'add header'),
true);
374 public function delheader($name = null, $debug = null) {
377 $this->Header = array();
378 return $this->_result(array(0 =>
'delete all headers'),
true);
379 }
else if (!(is_string($name) && strlen($name) >= 2 &&
FUNC5::is_alpha($name,
true,
'-'))) {
384 if (count($this->Header) > 0) {
385 $name = strtolower($name);
386 foreach ($this->Header as $header) {
387 if ($name == strtolower($header[
'name'])) $ret =
true;
388 else $new[] = $header;
392 $this->Header = $new;
393 return $this->_result(array(0 =>
'delete header'),
true);
394 }
else return FUNC5::trace($debug,
'header not found', 1);
398 public function subject($content = null, $charset = null, $encoding = null, $debug = null) {
401 if (!is_string($content)) $err[] =
'invalid content type';
404 if ($content ==
'') $err[] =
'invalid content value';
406 if ($charset != null) {
407 if (!is_string($charset)) $err[] =
'invalid charset type';
408 else if (!(strlen($charset) >= 2 &&
FUNC5::is_alpha($charset,
true,
'-'))) $err[] =
'invalid charset value';
410 if ($encoding != null) {
411 if (!is_string($encoding)) $err[] =
'invalid encoding type';
413 $encoding = strtolower($encoding);
414 if (!isset(
MIME5::$hencarr[$encoding])) $err[] =
'invalid encoding value';
417 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
419 $this->Subject = array(
'content' => $content,
'charset' => $charset,
'encoding' => $encoding);
420 return $this->_result(array(0 =>
'set subject'),
true);
424 public function text($content = null, $charset = null, $encoding = null, $debug = null) {
427 if (!(is_string($content) && $content !=
'')) $err[] =
'invalid content type';
428 if ($charset != null) {
429 if (!is_string($charset)) $err[] =
'invalid charset type';
430 else if (!(strlen($charset) >= 2 &&
FUNC5::is_alpha($charset,
true,
'-'))) $err[] =
'invalid charset value';
432 if ($encoding != null) {
433 if (!is_string($encoding)) $err[] =
'invalid encoding type';
435 $encoding = strtolower($encoding);
436 if (!isset(
MIME5::$mencarr[$encoding])) $err[] =
'invalid encoding value';
439 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
441 $this->Text = array(
'content' => $content,
'charset' => $charset,
'encoding' => $encoding);
442 return $this->_result(array(0 =>
'set text version'),
true);
446 public function html($content = null, $charset = null, $encoding = null, $debug = null) {
449 if (!(is_string($content) && $content !=
'')) $err[] =
'invalid content type';
450 if ($charset != null) {
451 if (!is_string($charset)) $err[] =
'invalid charset type';
452 else if (!(strlen($charset) >= 2 &&
FUNC5::is_alpha($charset,
true,
'-'))) $err[] =
'invalid charset value';
454 if ($encoding != null) {
455 if (!is_string($encoding)) $err[] =
'invalid encoding type';
457 $encoding = strtolower($encoding);
458 if (!isset(
MIME5::$mencarr[$encoding])) $err[] =
'invalid encoding value';
461 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
463 $this->Html = array(
'content' => $content,
'charset' => $charset,
'encoding' => $encoding);
464 return $this->_result(array(0 =>
'set html version'),
true);
468 public function attach($content = null, $type = null, $name = null, $charset = null, $encoding = null, $disposition = null,
$id = null, $debug = null) {
471 if (!(is_string($content) && $content !=
'')) $err[] =
'invalid content type';
473 if (!is_string($type)) $err[] =
'invalid type value';
476 if (strlen($type) < 4) $err[] =
'invalid type value';
480 if (!is_string($name)) $err[] =
'invalid name type';
483 if ($name ==
'') $err[] =
'invalid name value';
486 if ($charset != null) {
487 if (!is_string($charset)) $err[] =
'invalid charset type';
488 else if (!(strlen($charset) >= 2 &&
FUNC5::is_alpha($charset,
true,
'-'))) $err[] =
'invalid charset value';
490 if ($encoding == null) $encoding =
'base64';
491 else if (is_string($encoding)) {
492 $encoding = strtolower($encoding);
493 if (!isset(
MIME5::$mencarr[$encoding])) $err[] =
'invalid encoding value';
494 }
else $err[] =
'invalid encoding type';
495 if ($disposition == null) $disposition =
'attachment';
496 else if (is_string($disposition)) {
498 if (!($disposition ==
'inline' || $disposition ==
'attachment')) $err[] =
'invalid disposition value';
499 }
else $err[] =
'invalid disposition type';
501 if (!is_string(
$id)) $err[] =
'invalid id type';
504 if (
$id ==
'') $err[] =
'invalid id value';
507 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
509 $this->Attach[] = array(
'content' => $content,
'type' => $type,
'name' => $name,
'charset' => $charset,
'encoding' => $encoding,
'disposition' => $disposition,
'id' =>
$id);
510 return $this->_result(array(0 =>
'add attachment'),
true);
514 public function delattach($name = null, $debug = null) {
517 $this->Attach = array();
518 return $this->_result(array(0 =>
'delete all attachments'),
true);
519 }
else if (!(is_string($name) && strlen($name) > 1)) {
524 if (count($this->Attach) > 0) {
525 $name = strtolower($name);
526 foreach ($this->Attach as $att) {
527 if ($name == strtolower($att[
'name'])) $ret =
true;
532 $this->Attach = $new;
533 return $this->_result(array(0 =>
'delete attachment'),
true);
534 }
else return FUNC5::trace($debug,
'attachment not found', 1);
538 public function connect($host = null, $port = null, $user = null, $pass = null, $vssl = null, $tout = null, $name = null, $context = null, $auth = null, $debug = null) {
551 if ($ret =
SMTP5::connect($host, $port, $user, $pass, $vssl, $tout, $name, $context, $auth, $debug)) $this->_conns[] = $ret;
552 return $this->_result($_RESULT, $ret);
560 if (count($this->_conns) > 0) {
562 foreach ($this->_conns as $cres) {
563 if ($cres != $resc) $new[] = $cres;
565 $this->_conns = $new;
568 return $this->_result($_RESULT, $disc);
572 if (count($this->_conns) > 0) {
573 foreach ($this->_conns as $cres) {
578 return $this->_result($rarr, $disc);
582 public function send($resc = null, $debug = null) {
584 $_RESULT = $err = array();
586 if (is_resource($resc)) $delivery =
'relay';
588 if ($resc == null) $resc =
'local';
589 if (!is_string($resc)) $err[] =
'invalid connection type';
591 $resc = strtolower(trim($resc));
592 if ($resc ==
'local' || $resc ==
'client' || $resc ==
'sendmail' || $resc ==
'qmail') $delivery = $resc;
593 else $err[] =
'invalid connection value';
596 if (count($this->To) == 0) $err[] =
'to mail address is not set';
597 if (!isset($this->Subject[
'content'])) $err[] =
'mail subject is not set';
598 if (!(isset($this->Text[
'content']) || isset($this->Html[
'content']))) $err[] =
'mail message is not set';
599 if (count($err) > 0)
FUNC5::trace($debug, implode(
', ', $err));
601 $header[
'local'] = $header[
'client'] = array();
604 if (isset($this->From[
'address']) && is_string($this->From[
'address'])) {
605 $from = $this->From[
'address'];
607 if (isset($this->From[
'name']) && trim($this->From[
'name']) !=
'') {
609 isset($this->From[
'charset']) ? $this->From[
'charset'] : null,
610 isset($this->From[
'encoding']) ? $this->From[
'encoding'] : null,
612 if ($hn == $this->From[
'name']) $hn =
'"'.str_replace(
'"',
'\\"', $this->From[
'name']).
'"';
613 $hv .= $hn.
' <'.$this->From[
'address'].
'>';
614 }
else $hv .= $this->From[
'address'];
615 $header[
'local'][] = $hv;
616 $header[
'client'][] = $hv;
618 $addrs = $arr = array();
619 foreach ($this->To as
$to) {
620 if (isset($to[
'address']) &&
FUNC5::is_mail($to[
'address'],
false, $debug)) {
621 $addrs[] = $to[
'address'];
622 if (isset($to[
'name']) && trim($to[
'name']) !=
'') {
624 isset($to[
'charset']) ? $to[
'charset'] : null,
625 isset($to[
'encoding']) ? $to[
'encoding'] : null,
627 if ($hn == $to[
'name']) $hn =
'"'.str_replace(
'"',
'\\"', $to[
'name']).
'"';
628 $arr[] = $hn.
' <'.$to[
'address'].
'>';
629 }
else $arr[] = $to[
'address'];
632 if (count($arr) > 0) {
633 $to = implode(
', ', $arr);
634 $header[
'client'][] =
'To: '.implode(
', '.
MIME5::LE.
"\t", $arr);
635 }
else FUNC5::trace($debug,
'to mail address is not set');
636 if (count($this->Cc) > 0) {
638 foreach ($this->Cc as $cc) {
639 if (isset($cc[
'address']) &&
FUNC5::is_mail($cc[
'address'],
false, $debug)) {
640 $addrs[] = $cc[
'address'];
641 if (isset($cc[
'name']) && trim($cc[
'name']) !=
'') {
643 isset($cc[
'charset']) ? $cc[
'charset'] : null,
644 isset($cc[
'encoding']) ? $cc[
'encoding'] : null,
646 if ($hn == $cc[
'name']) $hn =
'"'.str_replace(
'"',
'\\"', $cc[
'name']).
'"';
647 $arr[] = $hn.
' <'.$cc[
'address'].
'>';
648 }
else $arr[] = $cc[
'address'];
651 if (count($arr) > 0) {
652 $header[
'local'][] =
'Cc: '.implode(
', ', $arr);
653 $header[
'client'][] =
'Cc: '.implode(
', '.
MIME5::LE.
"\t", $arr);
657 if (count($this->Bcc) > 0) {
659 foreach ($this->Bcc as $bcc) {
665 if (count($arr) > 0) {
666 $header[
'local'][] =
'Bcc: '.implode(
', ', $arr);
667 $hbcc =
MIME5::LE.
'Bcc: '.implode(
', ', $arr);
671 isset($this->Subject[
'charset']) ? $this->Subject[
'charset'] : null,
672 isset($this->Subject[
'encoding']) ? $this->Subject[
'encoding'] : null,
675 $header[
'client'][] =
'Subject: '.$hn;
676 if (is_int($this->Priority) || is_string($this->Priority)) {
678 if ($this->Priority == 1 || $this->Priority ==
'high') $arr = array(1,
'high');
679 else if ($this->Priority == 3 || $this->Priority ==
'normal') $arr = array(3,
'normal');
680 else if ($this->Priority == 5 || $this->Priority ==
'low') $arr = array(5,
'low');
682 $header[
'local'][] =
'X-Priority: '.$arr[0];
683 $header[
'local'][] =
'X-MSMail-Priority: '.$arr[1];
684 $header[
'local'][] =
'X-MimeOLE: Produced By XPertMailer v.4 MIME Class';
685 $header[
'client'][] =
'X-Priority: '.$arr[0];
686 $header[
'client'][] =
'X-MSMail-Priority: '.$arr[1];
687 $header[
'client'][] =
'X-MimeOLE: Produced By XPertMailer v.4 MIME Class';
690 $header[
'client'][] =
'Message-ID: <'.MIME5::unique().
'@xpertmailer.com>';
691 if (count($this->Header) > 0) {
692 foreach ($this->Header as $harr) {
693 if (isset($harr[
'name'], $harr[
'value']) && strlen($harr[
'name']) >= 2 &&
FUNC5::is_alpha($harr[
'name'],
true,
'-')) {
695 isset($harr[
'charset']) ? $harr[
'charset'] : null,
696 isset($harr[
'encoding']) ? $harr[
'encoding'] : null,
698 $header[
'local'][] = ucfirst($harr[
'name']).
': '.$hn;
699 $header[
'client'][] = ucfirst($harr[
'name']).
': '.$hn;
704 if (isset($this->Text[
'content'])) {
706 isset($this->Text[
'charset']) ? $this->Text[
'charset'] : null,
707 isset($this->Text[
'encoding']) ? $this->Text[
'encoding'] : null,
708 null, null, null, null, $debug);
710 if (isset($this->Html[
'content'])) {
712 isset($this->Html[
'charset']) ? $this->Html[
'charset'] : null,
713 isset($this->Html[
'encoding']) ? $this->Html[
'encoding'] : null,
714 null, null, null, null, $debug);
716 if (count($this->Attach) > 0) {
718 foreach ($this->Attach as $attach) {
719 if (isset($attach[
'content'])) {
721 isset($attach[
'type']) ? $attach[
'type'] : null,
722 isset($attach[
'name']) ? $attach[
'name'] : null,
723 isset($attach[
'charset']) ? $attach[
'charset'] : null,
724 isset($attach[
'encoding']) ? $attach[
'encoding'] : null,
725 isset($attach[
'disposition']) ? $attach[
'disposition'] : null,
726 isset($attach[
'id']) ? $attach[
'id'] : null,
730 if (count($att) == 0) $att = null;
733 if ($delivery ==
'relay') {
735 return $this->_result($_RESULT, $res);
736 }
else if ($delivery ==
'local') {
737 $rpath = (!
FUNC5::is_win() && $this->Path != null) ?
'-f '.$this->Path : null;
738 $spath = ($this->Path != null) ? @ini_set(
'sendmail_from', $this->Path) :
false;
739 if (!
FUNC5::is_win()) $arr[
'content'] = str_replace(
"\r\n",
"\n", $arr[
'content']);
740 $res = mail($to, $subject, $arr[
'content'], implode(
MIME5::LE, $header[
'local']).
MIME5::LE.$arr[
'header'], $rpath);
741 if ($spath) @ini_restore(
'sendmail_from');
742 return $this->_result(array(0 =>
'send mail local'), $res);
743 }
else if ($delivery ==
'client') {
745 foreach ($addrs as $addr) {
746 $exp = explode(
'@', $addr);
747 $group[strtolower($exp[1])][] = $addr;
750 $reg = (count($group) == 1);
751 foreach ($group as $domain => $arrs) {
752 $con =
SMTP5::mxconnect($domain, $this->Port, $this->Tout, $this->Name, $this->Context, $debug);
753 if ($reg) $this->_result(array($domain => $_RESULT));
756 if ($reg) $this->_result(array($domain => $_RESULT));
760 if (!$reg) $this->_result(array(0 =>
'send mail client'));
762 }
else if ($delivery ==
'sendmail' || $delivery ==
'qmail') {
764 $comm = (($delivery ==
'sendmail') ? $this->SendMail : $this->QMail).
' -oi'.(($this->Path != null) ?
' -f '.$this->Path :
'').
' -t';
765 if ($con = popen($comm,
'w')) {
766 if (fputs($con, implode(
MIME5::LE, $header[
'client']).$hbcc.MIME5::LE.$arr[
'header'].MIME5::LE.MIME5::LE.$arr[
'content'])) {
767 $res = pclose($con) >> 8 & 0xFF;
770 $this->_result(array(0 =>
'send mail using "'.ucfirst($delivery).
'" program'));
771 }
else $this->_result(array(0 => $res));
772 }
else $this->_result(array(0 =>
'can not write'));
773 }
else $this->_result(array(0 =>
'can not write line command'));