X-Git-Url: https://git.llucax.com/software/sercom-old.git/blobdiff_plain/70ceee2fbb4ac514ca54ec661793e8788a3295ec..0f9f3c1e19351409860692d236ae01006418c5da:/src/sc_fetch diff --git a/src/sc_fetch b/src/sc_fetch index a1a9ef0..7a1e407 100755 --- a/src/sc_fetch +++ b/src/sc_fetch @@ -1,10 +1,8 @@ #!/usr/bin/php4 path('intentos'); $mail = imap_fetchstructure($mbox, $msgid); + if (!mkdir_p($path)) return 'No se pudo crear el directorio'; foreach ($mail->parts as $id => $part) { $fname = part_filename($part); if ($fname) { logs("Escribiendo archivo '$fname' [enc={$part->encoding}]", DEBUG); $body = imap_fetchbody($mbox, $msgid, $id + 1); - $path = "$dir/" . $intento->path('intentos'); - if (!mkdir_p($path)) return 'No se pudo crear el directorio'; if (!file_put_contents("$path/$fname", decode_body($body, $part->encoding))) return "Error al guardar el archivo $fname"; } //if (part_is_source($part) $has_sources = true;