34 if ($mailfamily = $this->
getValue(
"tmail_family", getHttpVars(
"TMAIL_FAMILY"))) {
35 $action->parent->AddJsRef(
"?app=FDL&action=FCKDOCATTR&famid=" . $mailfamily);
46 include_once (
"FDL/sendmail.php");
47 include_once (
"FDL/Lib.Vault.php");
48 if (
$doc->isAffected()) {
52 'content_type' =>
'multipart/mixed'
54 $multi_rel = $multi_mix->addSubpart(
'', array(
55 'content_type' =>
'multipart/related'
69 "tmail_copymode" =>
"from",
70 "tmail_desttype" => $this->
getValue(
"tmail_fromtype") ,
71 "tmail_recip" =>
$from
76 $wdoc = new_doc($this->dbaccess,
$doc->wid);
79 foreach ($tdest as $k => $v) {
80 $toccbcc = $v[
"tmail_copymode"];
81 $type = $v[
"tmail_desttype"];
85 $mail = $v[
"tmail_recip"];
89 $aid = strtok($v[
"tmail_recip"],
" ");
90 $mail =
$doc->getRValue($aid);
95 $aid = strtok($v[
"tmail_recip"],
" ");
96 $mail = $wdoc->getRValue($aid);
101 $aid = strtok($v[
"tmail_recip"],
" ");
102 $mail =
$doc->getparamValue($aid);
107 $aid = strtok($v[
"tmail_recip"],
" ");
108 $mail = $wdoc->getparamValue($aid);
116 elseif ($wdoc) $udoc = & $wdoc;
118 $aid = strtok($v[
"tmail_recip"],
" ");
119 $vdocid = $udoc->getValue($aid);
120 $vdocid = str_replace(
'<BR>',
"\n", $vdocid);
121 if (strpos($vdocid,
"\n")) {
124 foreach ($tvdoc as
$docid) {
125 $umail = $udoc->getDocValue($docid,
'us_mail',
'');
126 if (!$umail) $umail = $udoc->getDocValue($docid,
'grp_mail',
'');
127 if ($umail) $tmail[] = $umail;
129 $mail = implode(
",", $tmail);
131 if (strpos($aid,
':')) $mail = $udoc->getRValue($aid);
133 $mail = $udoc->getRValue($aid .
':us_mail');
134 if (!$mail) $mail = $udoc->getRValue($aid .
':grp_mail');
141 $aid = strtok($v[
"tmail_recip"],
" ");
145 if ($mail)
$dest[$toccbcc][] = str_replace(array(
163 ) , html_entity_decode(
$subject, ENT_COMPAT,
"UTF-8"));
166 if ($this->sendercopy &&
getParam(
"FDL_BCC") ==
"yes") {
168 if ($umail !=
"")
$dest[
'bcc'][] = $umail;
171 $to = implode(
',', array_filter(
$dest[
'to'], create_function(
'$v',
'return!preg_match("/^\s*$/", $v);')));
172 $cc = implode(
',', array_filter(
$dest[
'cc'], create_function(
'$v',
'return!preg_match("/^\s*$/", $v);')));
173 $bcc = implode(
',', array_filter(
$dest[
'bcc'], create_function(
'$v',
'return!preg_match("/^\s*$/", $v);')));
174 $from = trim(implode(
',', array_filter(
$dest[
'from'], create_function(
'$v',
'return!preg_match("/^\s*$/", $v);'))));
181 $multi_rel->addSubpart($pfout, array(
182 'content_type' =>
'text/html',
183 'charset' =>
'UTF-8',
184 'encoding' =>
'quoted-printable'
188 foreach ($this->ifiles as $k => $v) {
189 if (file_exists(
$pubdir .
"/$v")) {
191 $multi_rel->addSubpart(
'', array(
194 'charset' =>
'UTF-8',
197 'encoding' =>
'base64',
198 'name_encoding' =>
'quoted-printable',
199 'filename_encoding' =>
'quoted-printable',
200 'disposition' =>
'inline',
207 foreach (
$ta as $k => $v) {
208 $vf =
$doc->getRValue(strtok($v,
" "));
211 foreach ($tvf as
$vf) {
214 if ($fileinfo[
"path"]) {
216 $multi_mix->addSubpart(
'', array(
217 'body_file' => $fileinfo[
'path'],
218 'content_type' => $fileinfo[
'mime_s'],
219 'charset' =>
'UTF-8',
220 'filename' => $fileinfo[
'name'],
221 'dfilename' => $fileinfo[
'name'],
222 'encoding' =>
'base64',
223 'name_encoding' =>
'quoted-printable',
224 'filename_encoding' =>
'quoted-printable',
225 'disposition' =>
'attachment'
235 $savecopy = $this->
getValue(
"tmail_savecopy") ==
"yes";
238 if (
$to) $recip.= sprintf(_(
"sendmailto %s") ,
$to);
239 if (
$cc) $recip.=
' ' . sprintf(_(
"sendmailcc %s") ,
$cc);
240 if ($bcc) $recip.=
' ' . sprintf(_(
"sendmailbcc %s") , $bcc);
243 $doc->addComment(sprintf(_(
"send mail %s with template %s") , $recip, $this->title));
244 addWarningMsg(sprintf(_(
"send mail %s") , $recip));
246 $doc->addComment(sprintf(_(
"cannot send mail %s with template %s : %s") , $recip, $this->title,
$err) ,
HISTO_ERROR);
247 addWarningMsg(sprintf(_(
"cannot send mail %s") ,
$err));
256 $tpl = str_replace(
"[",
"[", $tpl);
259 $ulink = ($this->
getValue(
"tmail_ulink") ==
"yes");
260 $doc->viewdefaultcard(
"mail", $ulink,
false,
true);
261 foreach ($this->keys as $k => $v)
$doc->lay->set($k, $v);
262 $body =
$doc->lay->gen();
263 $body = preg_replace(array(
264 "/SRC=\"([^\"]+)\"/e",
265 "/src=\"([^\"]+)\"/e"
266 ) ,
"\$this->srcfile('\\1')", $body);
272 $err = $this->senddocument(new_doc($this->dbaccess, 24470,
true));
286 if (substr($src, 0, 3) ==
"cid")
return "src=\"$src\"";
287 if (substr($src, 0, 4) ==
"http") {
295 if (strlen($url) <= 0) {
298 if (strcmp(substr($src, 0, strlen($url)) , $url) == 0) {
300 $chopped_src = substr($src, strlen($url));
304 if ($chopped_src ==
'') {
305 return sprintf(
'src="%s"', $src);
311 if (preg_match(
"/.*app=FDL.*action=EXPORTFILE.*vid=([0-9]*)/", $src, $reg)) {
317 if (!in_array(strtolower(
fileextension($src)) , $vext))
return "";
319 $this->ifiles[$cid] = $src;
320 return "src=\"cid:$cid\"";