33 global $db, $langs, $conf;
35 $langs->load(
"emailcollector@emailcollector");
40 $head[$h][0] =
dol_buildpath(
"/admin/emailcollector_card.php", 1).
'?id='.$object->id;
41 $head[$h][1] = $langs->trans(
"EmailCollector");
42 $head[$h][2] =
'card';
97 return isset($structure->parts) ? $structure->parts :
false;
108 return $part->ifdparameters ? $part->dparameters :
false;
120 $structure = imap_fetchstructure($mbox, $jk, FT_UID);
123 $attachments = array();
125 if (!empty($parts)) {
128 for ($i = 1; $i < $nb; $i++) {
131 if ($part->ifdisposition && strtolower($part->disposition) ==
"attachment") {
132 $ext = $part->subtype;
136 $filename = $part->dparameters[0]->value;
137 $filename = imap_utf8($filename);
138 $attachments[] = array(
'type' => $part->type,
'filename' => $filename,
'pos' => $fpos);
159 $mege = imap_fetchbody($mbox, $jk, $fpos, FT_UID);
176 $tmp = explode(
'.', $filename);
177 $ext = array_pop($tmp);
178 $filename = implode(
'.', $tmp);
179 if (!file_exists($path)) {
186 $filepath = $path . $filename .
'.' . $ext;
188 while (file_exists($filepath)) {
189 $filepath = $path . $filename .
'(' . $i .
').' . $ext;
192 file_put_contents($filepath, $data);
208 $message = imap_8bit($message);
211 $message = imap_binary($message);
217 $message = imap_base64($message);
220 $message = imap_qprint($message);
saveAttachment($path, $filename, $data)
Save joined file into a directory with a given name.
emailcollectorPrepareHead($object)
Prepare array of tabs for EmailCollector.
getFileData($jk, $fpos, $type, $mbox)
Get content of a joined file from its position into a given email.
getDParameters($part)
Array with joined files.
getParts($structure)
Get parts of a message.
getDecodeValue($message, $coding)
Decode content of a message.
getAttachments($jk, $mbox)
Get attachments of a given mail.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)