Upload via GUI (273 Dateien)

This commit is contained in:
2026-10-22 18:59:36 +00:00
parent 506ba8f7be
commit df19622630
2 changed files with 12 additions and 5 deletions
+8 -5
View File
@@ -27,6 +27,7 @@ if (php_sapi_name() !== 'cli' && !defined('DESKHUB_CRON_RUNNER')) { http_respons
*/
require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/mail_text.php';
/** Verarbeitet eine Mail nach dem Einlesen gemäß dem gewählten Modus */
function handle_after_fetch(mixed $mbox, int $emailNum, string $mode, string $folder): void
@@ -174,13 +175,15 @@ function fetch_emails_for_account(PDO $pdo, array $account, bool $verbose): arra
// Bei "delete" bleibt die Zuordnung zwar erhalten, die Originalmail ist danach jedoch nicht mehr verschiebbar.
$sourceFolderAfterFetch = $afterFetch === 'archive' ? $archiveFolder : $account['folder'];
// Nachrichtentext
$body = imap_fetchbody($mbox, $emailNum, '1');
$body = quoted_printable_decode($body);
// Nachrichtentext: Text-Teil bevorzugt, bei reinen HTML-Mails (Newsletter) nur der sichtbare Text ohne CSS und Skripte
$structure = @imap_fetchstructure($mbox, $emailNum);
$body = $structure ? mail_best_text($structure, fn(string $no) => (string) imap_fetchbody($mbox, $emailNum, $no)) : '';
if (trim($body) === '') {
$body = imap_fetchbody($mbox, $emailNum, '1.1') ?: '(kein Inhalt)';
// Unbekannter Aufbau: wie bisher den ersten Teil lesen, aber ebenfalls als Text aufbereiten
$raw = quoted_printable_decode((string) imap_fetchbody($mbox, $emailNum, '1'));
$body = mail_html_to_text($raw !== '' ? $raw : (string) imap_fetchbody($mbox, $emailNum, '1.1'));
}
$body = trim(strip_tags($body));
if (trim($body) === '') $body = '(kein Inhalt)';
// ── Antwort auf bestehendes Ticket? ──────────────────────────────────
if (preg_match('/\[#([0-9]{6}-[0-9]{4})\]/', $subject, $m)) {