Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New IMAP Library Does Not Handle No ContentType in Email Headers #7682

Closed
b1scuit-thi3f opened this issue Jul 14, 2020 · 4 comments
Closed
Assignees
Milestone

Comments

@b1scuit-thi3f
Copy link

b1scuit-thi3f commented Jul 14, 2020

Describe the bug

Since upgrading our system to 9.5.0, we have discovered that our email receiver does not work as expected. This was mostly fixed in #7643, however on further investigation, it appears that it now cannot handle emails in which we do not have a ContentType header.

This is the error we get when trying to receive emails.

[2020-07-14 10:55:02] glpiphplog.CRITICAL:   *** Uncaught Exception Laminas\Mail\Storage\Exception\InvalidArgumentException: Header with Name contentType or content-type not found in /var/www/html/glpi/vendor/laminas/laminas-mail/src/Storage/Part.php at line 307
  Backtrace :
  inc/mailcollector.class.php:2059                   Laminas\Mail\Storage\Part->getHeader()
  inc/mailcollector.class.php:1660                   MailCollector->getDecodedContent()
  inc/mailcollector.class.php:1017                   MailCollector->getBody()
  inc/mailcollector.class.php:714                    MailCollector->buildTicket()
  inc/mailcollector.class.php:1749                   MailCollector->collect()
  inc/crontask.class.php:847                         MailCollector::cronMailgate()
  front/cron.php:83                                  CronTask::launch()

Page(s) URL

https://{GLPIHOST}/glpi/front/mailcollector.form.php

To reproduce

The email should be imported into GLPI.

Expected behavior

A clear and concise description of what you expected to happen.

Logs

[2020-07-14 10:55:02] glpiphplog.CRITICAL:   *** Uncaught Exception Laminas\Mail\Storage\Exception\InvalidArgumentException: Header with Name contentType or content-type not found in /var/www/html/glpi/vendor/laminas/laminas-mail/src/Storage/Part.php at line 307
  Backtrace :
  inc/mailcollector.class.php:2059                   Laminas\Mail\Storage\Part->getHeader()
  inc/mailcollector.class.php:1660                   MailCollector->getDecodedContent()
  inc/mailcollector.class.php:1017                   MailCollector->getBody()
  inc/mailcollector.class.php:714                    MailCollector->buildTicket()
  inc/mailcollector.class.php:1749                   MailCollector->collect()
  inc/crontask.class.php:847                         MailCollector::cronMailgate()
  front/cron.php:83                                  CronTask::launch()

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

**General**
Operating system: Linux itsm01 18.04.1-Ubuntu SMP Tue Jun 30 23:04:16 UTC 2020 x86_64
PHP 7.2.24-0ubuntu apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apc,
	apcu, calendar, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, intl, json, ldap, libxml,
	mbstring, mysqli, mysqlnd, openssl, pcre, pdo_mysql, posix, readline, session, shmop, sockets, sodium, standard, sysvmsg,
	sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zlib)
Setup: max_execution_time="600" memory_limit="256M" post_max_size="8M" safe_mode="" session.save_handler="files"
	upload_max_filesize="50M" 
Software: Apache/2.4.29 (Ubuntu) (Apache/2.4.29 (Ubuntu) Server at REDACTED Port 443)
	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Server Software: (Ubuntu)
	Server Version: ubuntu
	Server SQL Mode: 
	Parameters: glpiuser@localhost/glpi
	Host info: Localhost via UNIX socket
	
PHP version is at least 7.2.0 - Perfect!PHP version is at least 7.2.0 - Perfect!
Sessions support is available - Perfect!Sessions support is available - Perfect!
Allocated memory > 64 Mio - Perfect!Allocated memory > 64 Mio - Perfect!
mysqli extension is installedmysqli extension is installed
ctype extension is installedctype extension is installed
fileinfo extension is installedfileinfo extension is installed
json extension is installedjson extension is installed
mbstring extension is installedmbstring extension is installed
iconv extension is installediconv extension is installed
zlib extension is installedzlib extension is installed
curl extension is installedcurl extension is installed
gd extension is installedgd extension is installed
simplexml extension is installedsimplexml extension is installed
intl extension is installedintl extension is installed
ldap extension is installedldap extension is installed
apcu extension is installedapcu extension is installed
Zend OPcache extension is installedZend OPcache extension is installed
xmlrpc extension is installedxmlrpc extension is installed
CAS extension is installedCAS extension is installed
exif extension is installedexif extension is installed
zip extension is not presentzip extension is not present
bz2 extension is not presentbz2 extension is not present
sodium extension is installedsodium extension is installed
Database version seems correct (5.7.30) - Perfect!Database version seems correct (5.7.30) - Perfect!
Timezones seems loaded in databaseTimezones seems loaded in database
The log file has been created successfully.The log file has been created successfully.
Write access to /etc/glpi/ has been validated.Write access to /etc/glpi/ has been validated.
Write access to /var/lib/glpi has been validated.Write access to /var/lib/glpi has been validated.
Write access to /var/lib/glpi/_dumps has been validated.Write access to /var/lib/glpi/_dumps has been validated.
Write access to /var/lib/glpi/_sessions has been validated.Write access to /var/lib/glpi/_sessions has been validated.
Write access to /var/lib/glpi/_cron has been validated.Write access to /var/lib/glpi/_cron has been validated.
Write access to /var/lib/glpi/_graphs has been validated.Write access to /var/lib/glpi/_graphs has been validated.
Write access to /var/lib/glpi/_lock has been validated.Write access to /var/lib/glpi/_lock has been validated.
Write access to /var/lib/glpi/_plugins has been validated.Write access to /var/lib/glpi/_plugins has been validated.
Write access to /var/lib/glpi/_tmp has been validated.Write access to /var/lib/glpi/_tmp has been validated.
Write access to /var/lib/glpi/_cache has been validated.Write access to /var/lib/glpi/_cache has been validated.
Write access to /var/lib/glpi/_rss has been validated.Write access to /var/lib/glpi/_rss has been validated.
Write access to /var/lib/glpi/_uploads has been validated.Write access to /var/lib/glpi/_uploads has been validated.
Write access to /var/lib/glpi/_pictures has been validated.Write access to /var/lib/glpi/_pictures has been validated.
Write access to /var/www/html/glpi/marketplace has been validated.Write access to /var/www/html/glpi/marketplace has been validated.

**Libraries**
tmlawed/htmlawed version 1.2.5 in (/var/www/html/glpi/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.1.6 in (/var/www/html/glpi/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.5 in (/var/www/html/glpi/vendor/simplepie/simplepie/library)
tecnickcom/tcpdf version 6.3.5 in (/var/www/html/glpi/vendor/tecnickcom/tcpdf)
michelf/php-markdown in (/var/www/html/glpi/vendor/michelf/php-markdown/Michelf)
true/punycode in (/var/www/html/glpi/vendor/true/punycode/src)
iamcal/lib_autolink in (/var/www/html/glpi/vendor/iamcal/lib_autolink)
sabre/dav in (/var/www/html/glpi/vendor/sabre/dav/lib/DAV)
sabre/http in (/var/www/html/glpi/vendor/sabre/http/lib)
sabre/uri in (/var/www/html/glpi/vendor/sabre/uri/lib)
sabre/vobject in (/var/www/html/glpi/vendor/sabre/vobject/lib)
laminas/laminas-cache in (/var/www/html/glpi/vendor/laminas/laminas-cache/src)
laminas/laminas-i18n in (/var/www/html/glpi/vendor/laminas/laminas-i18n/src)
laminas/laminas-serializer in (/var/www/html/glpi/vendor/laminas/laminas-serializer/src)
monolog/monolog in (/var/www/html/glpi/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/var/www/html/glpi/vendor/sebastian/diff/src)
elvanto/litemoji in (/var/www/html/glpi/vendor/elvanto/litemoji/src)
symfony/console in (/var/www/html/glpi/vendor/symfony/console)
scssphp/scssphp in (/var/www/html/glpi/vendor/scssphp/scssphp/src)
laminas/laminas-mail in (/var/www/html/glpi/vendor/laminas/laminas-mail/src/Protocol)
laminas/laminas-mime in (/var/www/html/glpi/vendor/laminas/laminas-mime/src)
rlanvin/php-rrule in (/var/www/html/glpi/vendor/rlanvin/php-rrule/src)
blueimp/jquery-file-upload in (/var/www/html/glpi/vendor/blueimp/jquery-file-upload/server/php)
ramsey/uuid in (/var/www/html/glpi/vendor/ramsey/uuid/src)
psr/log in (/var/www/html/glpi/vendor/psr/log/Psr/Log)
psr/simple-cache in (/var/www/html/glpi/vendor/psr/simple-cache/src)
mexitek/phpcolors in (/var/www/html/glpi/vendor/mexitek/phpcolors/src/Mexitek/PHPColors)
guzzlehttp/guzzle in (/var/www/html/glpi/vendor/guzzlehttp/guzzle/src)
wapmorgan/unified-archive in (/var/www/html/glpi/vendor/wapmorgan/unified-archive/src)
paragonie/sodium_compat in (/var/www/html/glpi/vendor/paragonie/sodium_compat/src)
phpCas version 1.3.3 in (/usr/share/php)

**Plugins**
actualtime           Name: ActualTime                     Version: 1.2.0      State: Installed / not activated
	fields               Name: Additionnal fields             Version: 1.11.0     State: Enabled
	behaviors            Name: Behaviours                     Version: 2.2.2      State: Enabled
	dashboard            Name: Dashboard                      Version: 0.9.6      State: Enabled
	escalade             Name: Escalation                     Version: 2.4.4      State: Enabled
	datainjection        Name: File injection                 Version: 2.7.0      State: Installed / not activated
	formcreator          Name: Form Creator                   Version: 2.10.0     State: Enabled
	itilcategorygroups   Name: ItilCategory Groups            Version: 2.4.0      State: Enabled
	mailanalyzer         Name: Mail Analyzer                  Version: 1.6.1      State: Enabled
	mreporting           Name: More Reporting                 Version: 1.7.0      State: Enabled
	genericobject        Name: Objects management             Version: 2.9.0      State: Enabled
	tag                  Name: Tag Management                 Version: 2.7.0      State: Enabled
	tasklists            Name: Tasks list                     Version: 1.5.1      State: Enabled
	timezones            Name: Timezones                      Version: 2.5.2      State: Installed / not activated

Additional context

sampleEmailNoContentHeader.zip

@trasher
Copy link
Contributor

trasher commented Jul 15, 2020

@b1scuit-thi3f #7688 should solve this issue, could you test on your side please?

@trasher
Copy link
Contributor

trasher commented Jul 15, 2020

And, by the way, thank you for the sample email, it has been added to the test suite ;)

@b1scuit-thi3f
Copy link
Author

Hi @trasher,
Sorry for the delayed response (patch Tuesday got in the way). I can confirm that this has fixed the issue, thank you!

@trasher
Copy link
Contributor

trasher commented Jul 16, 2020

No problem, thanks for the confirmation ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants