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.03k stars 1.26k forks source link

Mailgate Error #12818

Closed barte91 closed 1 year ago

barte91 commented 1 year ago

Code of Conduct

Is there an existing issue for this?

Version

10.0.3

Bug description

My mailgate failed to import some email

Relevant log output

glpiphplog.CRITICAL:   *** Uncaught Exception Laminas\Mail\Exception\InvalidArgumentException: The input is not a valid email address. Use the basic format local-part@hostname in /var/www/glpi/vendor/laminas/laminas-mail/src/Address.php at line 74
  Backtrace :
  vendor/laminas/laminas-mail/src/Address.php:50     Laminas\Mail\Address->__construct()
  ...inas-mail/src/Header/AbstractAddressList.php:92 Laminas\Mail\Address::fromString()
  :                                                  Laminas\Mail\Header\AbstractAddressList::Laminas\Mail\Header\{closure}()
  ...inas-mail/src/Header/AbstractAddressList.php:71 array_map()
  vendor/laminas/laminas-mail/src/Headers.php:556    Laminas\Mail\Header\AbstractAddressList::fromString()
  vendor/laminas/laminas-mail/src/Headers.php:282    Laminas\Mail\Headers->loadHeader()
  vendor/laminas/laminas-mail/src/Headers.php:102    Laminas\Mail\Headers->addHeaderLine()
  vendor/laminas/laminas-mime/src/Decode.php:162     Laminas\Mail\Headers::fromString()
  ...r/laminas/laminas-mail/src/Storage/Part.php:106 Laminas\Mime\Decode::splitMessage()
  ...laminas/laminas-mail/src/Storage/Message.php:47 Laminas\Mail\Storage\Part->__construct()
  ...r/laminas/laminas-mail/src/Storage/Imap.php:121 Laminas\Mail\Storage\Message->__construct()
  ...aminas-mail/src/Storage/AbstractStorage.php:270 Laminas\Mail\Storage\Imap->getMessage()
  src/MailCollector.php:731                          Laminas\Mail\Storage\AbstractStorage->current()
  src/MailCollector.php:1852                         MailCollector->collect()
  src/CronTask.php:1018                              MailCollector::cronMailgate()
  front/cron.php:84                                  CronTask::launch()

I see it reference to /var/www/glpi/vendor/laminas/laminas-mail/src/Address.php at line 74

       if (! $emailAddressValidator->isValid($email)) {
            $invalidMessages = $emailAddressValidator->getMessages();
            throw new Exception\InvalidArgumentException(array_shift($invalidMessages));
        }


### Page URL

_No response_

### Steps To reproduce

here the email that my mailgate failed: 
    INC2169661 - 123 Cerro- Collegamento cordless 851
    S
    ServiceNow <adeo@service-now.com>
    A:

        Net Project | Assistenza

    gio 22/09/2022 16:03

    Buongiorno,

    chiedono il collegamento cordless sulla linea telefono edilizia 851. Già attivato telefonicamente.

    Rif. OLTI SHQEPA

    Grazie

    Barbara

### Your GLPI setup information

<details><summary>Information about system installation and configuration</summary><pre>GLPI 10.0.3 (/glpi => /var/www/glpi)
Installation mode: TARBALL
Current language:en_GB

</details><details><summary>Server</summary><pre> 
Operating system: Linux NetSrv-glpi.netproject.local 5.14.0-168.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Sep 23 11:43:25 UTC 2022
    x86_64
PHP 8.1.11 fpm-fcgi (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apcu, bcmath, bz2, calendar, cgi-fcgi, ctype,
    curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, imagick, imap, intl, json, ldap, libxml,
    mbstring, memcache, memcached, msgpack, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_sqlite, redis, session, sockets, sodium,
    sqlite3, standard, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib)
Setup: max_execution_time="600" memory_limit="64M" post_max_size="8M" safe_mode="" session.save_handler="files"
    upload_max_filesize="2M" 
Software: Apache/2.4.53 (CentOS Stream) OpenSSL/3.0.1 ()
    Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
Server Software: Source distribution
    Server Version: 8.0.30
    Server SQL Mode: STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
    Parameters: glpi@localhost/glpi
    Host info: Localhost via UNIX socket

PHP version (8.1.11) is supported.
Sessions configuration is OK.
Allocated memory is sufficient.
mysqli extension is installed.
Following extensions are installed: dom, fileinfo, json, simplexml.
curl extension is installed.
gd extension is installed.
intl extension is installed.
libxml extension is installed.
zlib extension is installed.
The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present.
Database engine version (8.0.30) is supported.
The log file could not be created in /var/www/glpi/files/_log.
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.
Web access to files directory is protected
For security reasons, SELinux mode should be Enforcing.
PHP directive "session.cookie_httponly" should be set to "on" to prevent client-side script to access cookie values.
exif extension is installed.
ldap extension is installed.
openssl extension is installed.
zip extension is installed.
bz2 extension is installed.
Zend OPcache extension is installed.
Following extensions are installed: ctype, iconv, mbstring, sodium.
Write access to /var/www/glpi/marketplace has been validated.
Timezones seems loaded in database.

</details><details><summary>GLPI constants</summary><pre> 
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: 
</pre></details>

### Anything else?

_No response_
cedric-anne commented 1 year ago

Hi,

Could you please attach the email that cause the issue, in eml format ?

barte91 commented 1 year ago

Hi,

In the zip file you can retrive the email in eml format INC2169661 - 123 Cerro- Collegamento cordless 851.zip

cedric-anne commented 1 year ago

Reply-To: tm.aton.l1.tecnomat.it header is not valid. Indeed, address does not contain any @.

I close this issue as it is not a bug from GLPI. Message is invalid and is responsible of this error.