glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.12k stars 1.27k forks source link

[9.5.5] Collector email #9286

Closed Wacxiuz closed 2 years ago

Wacxiuz commented 3 years ago

Describe the bug

I configured the mail collector with a GMAIL mail address. Most of the mails are well retrieved and converted into tickets, however some mails do not pass and are in error. This problem also arises on an Office 365 mail. The errors are identical between the 2 mailboxes.

Page(s) URL

https://[glpi-host]/front/mailcollector.form.php?

To reproduce

Steps to reproduce the behavior:

  1. Send email to mailbox monitored by GLPI
  2. Navigate to https: // [glpi-host] /front/mailcollector.form.php?
  3. Click "retrieve emails now"
  4. See error

Expected behavior

The ticket should be generated based on the email without error.

Logs

tail /var/www/glpi/files/_log/mailgate.log Message invalide : Invalid header value detected
2021-07-15 08:25:29 [1052@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 08:25:29 [1052@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 08:27:52 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 08:27:53 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 08:28:05 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 08:28:05 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 08:29:10 [1052@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 08:29:11 [1052@SRVGLPI01]

Screenshots

image

Your GLPI setup (you can find it in Setup > General menu, System tab)

[code]   GLPI 9.5.5 ( => /var/www/glpi) Installation mode: TARBALL -- Operating system: Linux 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 PHP 8.0.8 fpm-fcgi (Core, FFI, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apcu, bz2, calendar, cgi-fcgi, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_sqlite, posix, readline, session, shmop, soap, sockets, sodium, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib) Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files" upload_max_filesize="2M" Software: Apache/2.4.38 (Debian) (Apache/2.4.38 (Debian) Server at srvglpi01.adetel.com Port 443) Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0 Server Software: MySQL Community Server (GPL) Server Version: 5.6.19 Server SQL Mode: Parameters: Host info: via TCP/IP PHP version is at least 7.2.0 - Perfect! Sessions support is available - Perfect! Allocated memory > 64 Mio - Perfect! mysqli extension is installed ctype extension is installed fileinfo extension is installed json extension is installed mbstring extension is installed iconv extension is installed zlib extension is installed curl extension is installed gd extension is installed simplexml extension is installed intl extension is installed ldap extension is installed apcu extension is installed Zend OPcache extension is installed xmlrpc extension is installed CAS extension is installed exif extension is installed zip extension is installed bz2 extension is installed sodium extension is installed Database version seems correct (5.6.19) - Perfect! Access to timezone database (mysql) is not allowed. The log file has been created successfully. Write access to /var/www/glpi/files/_cache has been validated. Write access to /var/www/glpi/config has been validated. Write access to /var/www/glpi/files/_cron has been validated. Write access to /var/www/glpi/files has been validated. Write access to /var/www/glpi/files/_dumps has been validated. Write access to /var/www/glpi/files/_graphs has been validated. Write access to /var/www/glpi/files/_lock has been validated. Write access to /var/www/glpi/files/_pictures has been validated. Write access to /var/www/glpi/files/_plugins has been validated. Write access to /var/www/glpi/files/_rss has been validated. Write access to /var/www/glpi/files/_sessions has been validated. Write access to /var/www/glpi/files/_tmp has been validated. Write access to /var/www/glpi/files/_uploads has been validated. Write access to /var/www/glpi/marketplace has been validated. Web access to files directory is protected GLPI_ROOT: /var/www/glpi GLPI_CONFIG_DIR: /var/www/glpi/config GLPI_VAR_DIR: /var/www/glpi/files GLPI_MARKETPLACE_DIR: /var/www/glpi/marketplace GLPI_USE_CSRF_CHECK: 1 GLPI_CSRF_EXPIRES: 7200 GLPI_CSRF_MAX_TOKENS: 100 GLPI_USE_IDOR_CHECK: 1 GLPI_IDOR_EXPIRES: 7200 GLPI_ALLOW_IFRAME_IN_RICH_TEXT: GLPI_TELEMETRY_URI: https://telemetry.glpi-project.org GLPI_INSTALL_MODE: TARBALL GLPI_NETWORK_MAIL: glpi@teclib.com GLPI_NETWORK_SERVICES: https://services.glpi-network.com GLPI_MARKETPLACE_PRERELEASES: GLPI_MARKETPLACE_ALLOW_OVERRIDE: 1 GLPI_MARKETPLACE_MANUAL_DOWNLOADS: 1 GLPI_USER_AGENT_EXTRA_COMMENTS: GLPI_AJAX_DASHBOARD: 1 GLPI_CALDAV_IMPORT_STATE: 0 GLPI_DEMO_MODE: 0 GLPI_FORCE_EMPTY_SQL_MODE: 1 GLPI_DOC_DIR: /var/www/glpi/files GLPI_CACHE_DIR: /var/www/glpi/files/_cache GLPI_CRON_DIR: /var/www/glpi/files/_cron GLPI_DUMP_DIR: /var/www/glpi/files/_dumps GLPI_GRAPH_DIR: /var/www/glpi/files/_graphs GLPI_LOCAL_I18N_DIR: /var/www/glpi/files/_locales GLPI_LOCK_DIR: /var/www/glpi/files/_lock GLPI_LOG_DIR: /var/www/glpi/files/_log GLPI_PICTURE_DIR: /var/www/glpi/files/_pictures GLPI_PLUGIN_DOC_DIR: /var/www/glpi/files/_plugins GLPI_RSS_DIR: /var/www/glpi/files/_rss GLPI_SESSION_DIR: /var/www/glpi/files/_sessions GLPI_TMP_DIR: /var/www/glpi/files/_tmp GLPI_UPLOAD_DIR: /var/www/glpi/files/_uploads GLPI_NETWORK_REGISTRATION_API_URL: https://services.glpi-network.com/api/registration/ GLPI_MARKETPLACE_PLUGINS_API_URI: https://services.glpi-network.com/api/glpi-plugins/ GLPI_I18N_DIR: /var/www/glpi/locales GLPI_VERSION: 9.5.5 GLPI_SCHEMA_VERSION: 9.5.5 GLPI_MIN_PHP: 7.2.0 GLPI_YEAR: 2021 htmlawed/htmlawed version 1.2.5 in (/var/www/glpi/vendor/htmlawed/htmlawed) phpmailer/phpmailer version 6.1.6 in (/var/www/glpi/vendor/phpmailer/phpmailer/src) simplepie/simplepie version 1.5.6 in (/var/www/glpi/vendor/simplepie/simplepie/library) tecnickcom/tcpdf version 6.3.5 in (/var/www/glpi/vendor/tecnickcom/tcpdf) michelf/php-markdown in (/var/www/glpi/vendor/michelf/php-markdown/Michelf) true/punycode in (/var/www/glpi/vendor/true/punycode/src) iamcal/lib_autolink in (/var/www/glpi/vendor/iamcal/lib_autolink) sabre/dav in (/var/www/glpi/vendor/sabre/dav/lib/DAV) sabre/http in (/var/www/glpi/vendor/sabre/http/lib) sabre/uri in (/var/www/glpi/vendor/sabre/uri/lib) sabre/vobject in (/var/www/glpi/vendor/sabre/vobject/lib) laminas/laminas-cache in (/var/www/glpi/vendor/laminas/laminas-cache/src) laminas/laminas-i18n in (/var/www/glpi/vendor/laminas/laminas-i18n/src) laminas/laminas-serializer in (/var/www/glpi/vendor/laminas/laminas-serializer/src) monolog/monolog in (/var/www/glpi/vendor/monolog/monolog/src/Monolog) sebastian/diff in (/var/www/glpi/vendor/sebastian/diff/src) elvanto/litemoji in (/var/www/glpi/vendor/elvanto/litemoji/src) symfony/console in (/var/www/glpi/vendor/symfony/console) scssphp/scssphp in (/var/www/glpi/vendor/scssphp/scssphp/src) laminas/laminas-mail in (/var/www/glpi/vendor/laminas/laminas-mail/src/Protocol) laminas/laminas-mime in (/var/www/glpi/vendor/laminas/laminas-mime/src) rlanvin/php-rrule in (/var/www/glpi/vendor/rlanvin/php-rrule/src) blueimp/jquery-file-upload in (/var/www/glpi/vendor/blueimp/jquery-file-upload/server/php) ramsey/uuid in (/var/www/glpi/vendor/ramsey/uuid/src) psr/log in (/var/www/glpi/vendor/psr/log/Psr/Log) psr/simple-cache in (/var/www/glpi/vendor/psr/simple-cache/src) mexitek/phpcolors in (/var/www/glpi/vendor/mexitek/phpcolors/src/Mexitek/PHPColors) guzzlehttp/guzzle in (/var/www/glpi/vendor/guzzlehttp/guzzle/src) guzzlehttp/psr7 in (/var/www/glpi/vendor/guzzlehttp/psr7/src) wapmorgan/unified-archive in (/var/www/glpi/vendor/wapmorgan/unified-archive/src) paragonie/sodium_compat in (/var/www/glpi/vendor/paragonie/sodium_compat/src) phpCas version 1.3.6 in (/usr/share/php/CAS/source) Not active screenshot Name: Capture d'écran Version: 1.1.3 State: Enabled fields Name: Champs supplémentaires Version: 1.12.4 State: Enabled behaviors Name: Comportements Version: 2.4.1 State: Installed / not activated datainjection Name: Data Injection Version: 2.9.0 State: Enabled escalade Name: Escalades Version: 2.6.1 State: Enabled formcreator Name: Form Creator Version: 2.11.2 State: Enabled fusioninventory Name: FusionInventory Version: 9.5+3.0 State: Enabled itilcategorygroups Name: Helpdesk catégories groupes Version: 2.4.0 State: Not installed metabase Name: metabase Version: 1.2.1 State: Not installed moreticket Name: More ticket Version: 1.6.1 State: Not installed mreporting Name: Plus de rapports Version: 1.7.3 State: Installed / not activated reports Name: Rapports Version: 1.14.0 State: Not installed [/code]
trasher commented 3 years ago

Please try with up to date current bugfixes branch (or latest nightly)

Wacxiuz commented 3 years ago

Please try with up to date current bugfixes branch (or latest nightly)

Hello, The problem is still there. Thanks

cedric-anne commented 3 years ago

Hi,

Could you please attach related email into eml format ?

Regards

Wacxiuz commented 3 years ago

Hi,

Could you please attach related email into eml format ?

Regards

Delivered-To: mail.gmail@gmail.com Received: by 2002:a05:6838:752:0:0:0:0 with SMTP id n18csp390058nkm; Thu, 1 Jul 2021 00:28:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSnV/GNVGDmgBqCPEGMCWl3aeUiTrjyHsdGXoP1f3LDEBtzVgjMEpx6QVNXrNwx4nusBte X-Received: by 2002:a05:6402:4386:: with SMTP id o6mr22298574edc.220.1625124491340; Thu, 01 Jul 2021 00:28:11 -0700 (PDT) Return-Path: no-reply@nomsociete.com Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90048.outbound.protection.outlook.com. [40.107.9.48]) by mx.google.com with ESMTPS id hx15si22314056ejc.635.2021.07.01.00.28.10 for mail.gmail@gmail.com (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jul 2021 00:28:11 -0700 (PDT) Received-SPF: pass (google.com: domain of no-reply@nomsociete.com designates 40.107.9.48 as permitted sender) client-ip=40.107.9.48; Authentication-Results: mx.google.com; dkim=fail header.i=@nomsociete.com header.s=selector2 header.b=Crg3wUCa; arc=fail (signature failed); spf=pass (google.com: domain of no-reply@nomsociete.com designates 40.107.9.48 as permitted sender) smtp.mailfrom=no-reply@nomsociete.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=nomsociete.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZDv6PtnTDG/sVRe4A2ksSEvhOj5nmWt1I1/9fpZG6MnmzTV+sgwAVBowh2laGJsHomO2LygZ4o1Dg2ERZb6G71XAF+BHBHROq8Iliab2jjAMq93HST21yacZK6QAL2vRtsGqaqbRchCEI2TD3Yc1yrVST0hCUkDREmt0AazP3N+8Ftn/xW51bJGPv2LPM9HwCRU+dquF7AbnK20BYdf8cFoE0K3BOvjiPAZU09chJGVLGgi4fhPzWcCrTdS7aeXWSbGioqBLjs7VdsO3eLdGJgg0SYyRb6SX/mPk2TqUmxeed0P+S2C0OAsCysFdVUZhuJ5vNKjdIetg5kvpihoeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=44teoLrA0/gK1GYFj4vjd6HfpyArvd3qu4OCZiKR3y4=; b=SoR55o9YJwqFgA64cIVNozB9I3DYXQVhczdpnVya0PZdj5TjfOXam64lfdDi9mXPN6Zftpi+SF+u6tbYf5pCR4nt8OkNP2VbihXBO0HPfox5Jm+GVXGZK4fhMz6iY58+NkVj3ovBlrkDnrgDMsZkpfeYc6c4MMfEbeOSXH8qjNC+9CvNpCPXavR//kgFfBJx3/aC6PzY75UN77UOmTGJITEmh7JWCCept+iDKSusc9fJmN15/e0wnH0yf8CJPciuGssqXa74snoinz7Avf1TwXwy0+BwnGJIkk+0rwy0HTWGWZxtQWRCMu5gAvJlnVCDiW0UaPCVfwvF/ktohCYsqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 37.71.189.20) smtp.rcpttodomain=centumadetel.com smtp.mailfrom=nomsociete.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nomsociete.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nomsociete.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=44teoLrA0/gK1GYFj4vjd6HfpyArvd3qu4OCZiKR3y4=; b=Crg3wUCab2pmRo43Z5azWBClH8BVsrUp5R4twjylmVARWOFNa7y5M5p16IxJ05sYeta8C2zQcUexzzM9Mj5grBaTdYfDJG47K/drT6+0fkJM8Tb0wLkzzjG5gTo+uMQGv43cyCEA806tZ8FRDrWECD0fcpdkIkEmNLDu00E/5WI2rvWZ6Xy3/zudKlaTP7GrLYNPQrF+03yxJa08cRj7qYj/dMHiB0gsN5DVLcYMjTPHWL9Stxnd0xcu185r44eiRdaRJs5E5tkA75S6JJcXhTKgGLmhtuEsrFA0FRRZgnMLW7fWH+PU/nnRY5MZaRzJImOiIG0YiCCGQxnP9WJgwQ== Received: from PR0P264CA0183.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::27) by PR1P264MB1743.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1b3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.21; Thu, 1 Jul 2021 07:28:09 +0000 Received: from VE1EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:100:1c::4) by PR0P264CA0183.outlook.office365.com (2603:10a6:100:1c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Thu, 1 Jul 2021 07:28:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 37.71.189.20) smtp.mailfrom=nomsociete.com; centumadetel.com; dkim=none (message not signed) header.d=none;centumadetel.com; dmarc=pass action=none header.from=nomsociete.com; Received-SPF: Pass (protection.outlook.com: domain of nomsociete.com designates 37.71.189.20 as permitted sender) receiver=protection.outlook.com; client-ip=37.71.189.20; helo=localhost; Received: from localhost (37.71.189.20) by VE1EUR03FT051.mail.protection.outlook.com (10.152.19.75) with Microsoft SMTP Server id 15.20.4287.22 via Frontend Transport; Thu, 1 Jul 2021 07:28:08 +0000 From: no-reply@nomsociete.com Subject: objet du mail Content-type: text/html;charset=UTF-8 To: email@email.fr X-WatchGuard-AntiVirus: part scanned. clean action=allow Message-ID: 17e87ac6-7bbd-4c67-8563-ae799651737e@VE1EUR03FT051.eop-EUR03.prod.protection.outlook.com Return-Path: no-reply@nomsociete.com Date: Thu, 1 Jul 2021 07:28:08 +0000 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 9164626d-6d43-431c-0501-08d93c61c68f X-MS-TrafficTypeDiagnostic: PR1P264MB1743: X-LD-Processed: 81736bef-0655-458b-a529-ba074e9554e9,ExtAddr X-MS-Exchange-AtpMessageProperties: SA|SL X-Microsoft-Antispam-PRVS: PR1P264MB17432AC083FF42BE1714FEF589009@PR1P264MB1743.FRAP264.PROD.OUTLOOK.COM X-MS-Oob-TLC-OOBClassifiers: OLM:989; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RVXzoIcYB8Xm2+9k7Bf2c9wV69KVUhUAD5hydKe6SJVWgKYobZAn9VI+J6ouJjRdIpqA8Z33YCqNK+6zCulg99bBvhe1RzvEdzA1wKfOQv2wx+7co0V7i3BGGIGs1TJH2aeHMKk0aUV3T02MKPHTF+z5wLBCIzi7tSKGtEfNqaGCi5vOI2miKMby2q8lwMzfUz0RH6U0wPCVLebDAgxmzB053ZnSIosm7TQXzOJw2IV6fR1lVuoSE+41R1HEUx8gYtoLMyJ37kSErTtYML+PoMzk+nyhneIdaPXxB4liU4URKHPfHspO99fXQ7DvjXiOImG3ww+Mle9u46/ETy3v6QZ8MyBWQOQ9tBSkOKLPkTZEHhG6qE0GZFa1iloIJve37bdDNOxvhXaQAuqzjzbO++c5DGqXYPKzIcs9jHCHMb6kcZxobQEiHk7/wOXyW2zO47s9LqoeL55i3tCmDDtApkgExOxeoiDLnEda2sYTp50qOud2r17ph1d0u2BPj/0KR6VbLNv6oQMlscQc6ITfRLqYyX27ahmKJ/e1/70hMR9AMB7IW3YYqTY7AR6c5MzL5FgvOYmAyP/fSyoN5p7StpYetTImvSNfqNaTgAGqUIpwvmiUsa4r1bNWeL0bJDll4LseylYGroauSh90e0NPYCdC8llB8OleZPJWzeyBFr+37rJ3Ywba0SPmzOBxLkCFt2eKYK9ZRLcqSEQbVwG+j4GYWqt0f4nYfp0iVZBgD2VKBFlwW8AP7OSH6lCLrm8VW8XmVaa1PNpOlGucNXCAPaVjne4U9ZesOA/bKkEu5IjGBIPeIwFsk7FxMlVaDQTrY6rkBuSELH764TiibtzZCA== X-Forefront-Antispam-Report: CIP:37.71.189.20;CTRY:FR;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:localhost;PTR:20.189.71.37.rev.sfr.net;CAT:NONE;SFS:(6069001)(4636009)(136003)(376002)(396003)(39830400003)(346002)(36840700001)(46966006)(9686003)(81166007)(6496006)(70206006)(316002)(356005)(36860700001)(31686004)(47076005)(70586007)(186003)(31696002)(36736006)(5660300002)(558084003)(86362001)(6486002)(26005)(82310400003)(8936002)(336012)(956004)(224303003)(16799955002)(34206002)(478600001)(2906002)(166002);DIR:OUT;SFP:1101; X-Auto-Response-Suppress: DR, OOF, AutoReply X-MS-Exchange-Transport-Forked: True X-OriginatorOrg: nomsociete.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2021 07:28:08.9502 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9164626d-6d43-431c-0501-08d93c61c68f X-MS-Exchange-CrossTenant-Id: 81736bef-0655-458b-a529-ba074e9554e9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=81736bef-0655-458b-a529-ba074e9554e9;Ip=[37.71.189.20];Helo=[localhost] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR1P264MB1743

Hello,

A new project has been created: **

Client: * Project Manager: ** Project Junior Manager: * Sales agent: Agency: Project type: ****

Best regards.

cedric-anne commented 3 years ago

I am able to collect both emails on my local version of GLPI. I guess the malformed header has been fixed during export of your email.

You can try to apply #9288 to be able to get more information about the error.

To be honest, if the source email is malformed, we cannot really fix your issue on GLPI side. You will have to identify the malformed header and fix this issue on the software responsible of this email sending.

Wacxiuz commented 3 years ago

I am able to collect both emails on my local version of GLPI. I guess the malformed header has been fixed during export of your email.

You can try to apply #9288 to be able to get more information about the error.

To be honest, if the source email is malformed, we cannot really fix your issue on GLPI side. You will have to identify the malformed header and fix this issue on the software responsible of this email sending.

Thanks for your feedback. On my side, on the php-errors file, here are my errors:

inc/commondbtm.class.php:4056 CommonDBTM->getSearchOptionByField() inc/commondbtm.class.php:1143 CommonDBTM->filterValues() marketplace/formcreator/hook.php:350 CommonDBTM->add() inc/plugin.class.php:1353 plugin_formcreator_hook_add_ticket() inc/commondbtm.class.php:1207 Plugin::doHook() inc/mailcollector.class.php:820 CommonDBTM->add() inc/mailcollector.class.php:1742 MailCollector->collect() inc/crontask.class.php:943 MailCollector::cronMailgate() front/cron.php:83 CronTask::launch()

cedric-anne commented 3 years ago

Please provide the complete trace.

Wacxiuz commented 3 years ago

root@SRVGLPI01:/var/www/glpi# tail /var/www/glpi/files/_log/php-errors.log inc/commondbtm.class.php:4056 CommonDBTM->getSearchOptionByField() inc/commondbtm.class.php:1143 CommonDBTM->filterValues() marketplace/formcreator/hook.php:350 CommonDBTM->add() inc/plugin.class.php:1353 plugin_formcreator_hook_add_ticket() inc/commondbtm.class.php:1207 Plugin::doHook() inc/mailcollector.class.php:820 CommonDBTM->add() inc/mailcollector.class.php:1742 MailCollector->collect() inc/crontask.class.php:943 MailCollector::cronMailgate() front/cron.php:83 CronTask::launch()

root@SRVGLPI01:/var/www/glpi# tail /var/www/glpi/files/_log/mailgate.log Message invalide : Invalid header value detected
2021-07-15 13:07:08 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 13:09:03 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 13:09:03 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 13:09:09 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 13:09:09 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 13:11:03 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 13:11:03 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 13:11:08 [@SRVGLPI01] Message invalide : Invalid header value detected
2021-07-15 13:11:09 [@SRVGLPI01] Message invalide : Invalid header value detected
root@SRVGLPI01:/var/www/glpi#

cedric-anne commented 3 years ago

There are missing line before inc/commondbtm.class.php:4056 CommonDBTM->getSearchOptionByField() .

Wacxiuz commented 3 years ago

Oh yes sorry, [2021-07-15 08:53:08] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01"} [2021-07-15 08:53:08] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01","mem_usage":"0.002\", 7.13Mio)"} [2021-07-15 08:53:12] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01"} [2021-07-15 08:53:12] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01","mem_usage":"0.036\", 7.53Mio)"} [2021-07-15 08:53:29] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01"} [2021-07-15 08:53:29] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01","mem_usage":"0.003\", 9.00Mio)"} [2021-07-15 08:55:12] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01"} [2021-07-15 08:55:12] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01","mem_usage":"0.002\", 7.42Mio)"} [2021-07-15 08:56:26] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01"} [2021-07-15 08:56:26] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01","mem_usage":"0.003\", 8.55Mio)"} [2021-07-15 08:57:09] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01"} [2021-07-15 08:57:38] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01"} [2021-07-15 08:57:38] glpiphplog.WARNING: CommonDBTM::getFromDBByCrit() in /var/www/glpi/inc/commondbtm.class.php line 351 getFromDBByCrit expects to get one result, 2 found! {"user":"1311@SRVGLPI01","mem_usage":"0.001\", 7.53Mio)"} [2021-07-15 08:58:08] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "glpiactive_entity" in /var/www/glpi/marketplace/formcreator/inc/issue.class.php at line 400 Backtrace : inc/commondbtm.class.php:3677 PluginFormcreatorIssue->rawSearchOptions() inc/commondbtm.class.php:3984 CommonDBTM->searchOptions() inc/commondbtm.class.php:4056 CommonDBTM->getSearchOptionByField() inc/commondbtm.class.php:1143 CommonDBTM->filterValues() marketplace/formcreator/hook.php:350 CommonDBTM->add() inc/plugin.class.php:1353 plugin_formcreator_hook_add_ticket() inc/commondbtm.class.php:1207 Plugin::doHook() inc/mailcollector.class.php:820 CommonDBTM->add() inc/mailcollector.class.php:1742 MailCollector->collect() inc/crontask.class.php:943 MailCollector::cronMailgate() front/cron.php:83 CronTask::launch()

cedric-anne commented 3 years ago

Did you applied #9288 ? There is nothing in your php-errors.log related to the mail collector error.

Wacxiuz commented 3 years ago

[2021-07-15 13:36:46] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Header\Exception\InvalidArgumentException: Invalid header value detected in /var/www/glpi/vendor/laminas/laminas-mail/src/Header/GenericHeader.php at line 64 Backtrace : vendor/laminas/laminas-mail/src/Headers.php:544 Laminas\Mail\Header\GenericHeader::splitHeaderLine() vendor/laminas/laminas-mail/src/Headers.php:284 Laminas\Mail\Headers->loadHeader() vendor/laminas/laminas-mail/src/Headers.php:105 Laminas\Mail\Headers->addHeaderLine() ...r/laminas/laminas-mail/src/Storage/Part.php:113 Laminas\Mail\Headers::fromString() ...laminas/laminas-mail/src/Storage/Message.php:53 Laminas\Mail\Storage\Part->construct() ...or/laminas/laminas-mail/src/Storage/Pop3.php:64 Laminas\Mail\Storage\Message->construct() ...aminas-mail/src/Storage/AbstractStorage.php:268 Laminas\Mail\Storage\Pop3->getMessage() inc/mailcollector.class.php:721 Laminas\Mail\Storage\AbstractStorage->current() front/mailcollector.form.php:88 MailCollector->collect()

wytchmaster commented 3 years ago

I have exactly the same problem. It occures with mail from GMail and Protonmail. When sending Mail from other accounts, it generally works. The problem occures always, when sending from the web interface and when sending HTML or HTML/plaintext messages from Thunderbird. It does not occure if sending only plaintext via thunderbird (from the GMail account). I have no problems when sending HTML or HTML/plaintext mails via my own server (using the same mail programm). Unfortunately some customers of mine use GMail as mail provider ....

cedric-anne commented 3 years ago

@wytchmaster

Please attach an export of an email that cause the issue, into eml format.

Regards

wytchmaster commented 3 years ago

This mails are not imported with the error message shown before: not_imported_mails.zip I use a mailcow mail server hosted at home (https://mailcow.email)

This is an example sent from the same mail programm via an other mailserver to the same GLPI instance. This one is imported. working_example_sent_via_other_mailserver.zip This one uses my providers mailserver. Strange behaviour, but I haven't found an obvious error ...

wytchmaster commented 2 years ago

I have isolated the problem. It's caused by a mail header inserted by proxmox mail gateway. If you disabled inserting of the spam score header, GLPI is importing the mail without problem. Maybe the german umlaut is the problem: X-SPAM-LEVEL: Spam detection results: 0 AWL -0.150 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider HTML_MESSAGE 0.001 Nachricht enthält HTML KAM_NUMSUBJECT 0.5 Subject ends in numbers excluding current years RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust RCVD_IN_MSPIKE_H2 -0.001 Average reputation (+2) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: Senderechner entspricht SPF-Datensatz

I will check that by end of the week.

cedric-anne commented 2 years ago

As far as I understand, e-mail headers should only contains US-ASCII chars (see https://datatracker.ietf.org/doc/html/rfc2822#section-2.2).

We are using an external lib to fetch emails, and I doubt we would be able to change their policy to accept "invalid" chars (see https://github.com/laminas/laminas-mail/blob/2.16.x/src/Header/HeaderValue.php#L64 ). You may try to open an issue or a PR on their repository. If a fix is accepted, we would be able to include it in a future version of GLPI.

You may also open an issue on Proxmox forum.

I am closing this issue as we cannot do anything for this on GLPI side.

troloff commented 2 years ago

We (glpi 9.5.6) still are having issues with invalid email headers.

Mostly, they seem to come from empty lines in spam headers (X-Spam_report), which trigger errors in vendor/laminas/laminas-mail/src/Headers.php lines 92 and 98: *** Uncaught Exception Laminas\Mail\Exception\RuntimeException: Malformed header detected in /var/www/inventory.net.adk.de/vendor/laminas/laminas-mail/src/Headers.php at line 92 *** Uncaught Exception Laminas\Mail\Exception\RuntimeException: Malformed header detected in /var/www/inventory.net.adk.de/vendor/laminas/laminas-mail/src/Headers.php at line 98

I commented out these lines to see what happens, and ran into the next issue: *** Uncaught Exception Laminas\Mail\Header\Exception\InvalidArgumentException: Invalid header value detected in /var/www/inventory.net.adk.de/vendor/laminas/laminas-mail/src/Header/GenericHeader.php at line 64

As a quick and dirty fix I replaced GenericHeader.php/line 64 with

//throw new Exception\InvalidArgumentException('Invalid header value detected');
$parts[1] = 'Invalid header';

and now the mails got picked up.

As @cedric-anne pointed out, this may rather be an issue with the receiving server adding these spam headers. But maybe there is a way to sanitize/blacklist/drop these (quite useless in the scope of glpi) headers before fetching the mails.