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.24k stars 1.29k forks source link

An empty message sent by e-mail as a comment to the ticket creates an error in the mail receiver, is not deleted and hangs in the Inbox, there is an error "If you reject the solution, you must specify a reason" in the log even if the ticket does not have a solution yet. #9726

Closed BorisNovg closed 2 years ago

BorisNovg commented 3 years ago

Code of Conduct

Is there an existing issue for this?

Version

9.5.6

Bug description

The user to whom we provide support services responds to a comment on the ticket by e-mail, however, the comment does not appear in the web interface of our GLPI-based support system, and the letter remains indefinitely in the Inbox of the mail receiver.

The analysis of the letter shows that the user just accidentally deleted the line =-=-=-= To answer by email, write above this line =-=-=-=, habitually removing unnecessary lines From: Sent: To: Subject: from the header of the letter.

The problem is not reproduced if the user writes the FIRST comment to the ticket (in this case, a letter with a comment without the line =-=-=-= To answer by email, write above this line =-=-=-= is processed in a completely normal way and appears in the web interface of our GLPI-based support system).

But if there are already at least 3 comments in the dialog with the user, an error occurs.

In addition, a very strange error is recorded in the log, clearly indicating an incorrectly compiled algorithm for processing mail messages: "If you reject the solution, you must specify a reason". Please note that the ticket is not closed at this moment, and the error message indicates that the algorithm got into the part of the code that gives an error with this text, obviously by accident. glpi-comment-1

Relevant log output

cron.log
``
2021-10-19 12:31:01 [@help.admreg.nov.ru]
External #1: Run mailgate
2021-10-19 12:31:02 [@help.admreg.nov.ru]
If you reject the solution, you must specify a reason

``

php-errors.log
``
(At this point in time, nothing is written to the log)
``
Home-Setup-Automatic actions-mailgate-Logs-12:31
``
0 Run mode: CLI
0 Collect mails from XXX@XXX.ru ({10.10.1.72/imap/ssl/novalidate-cert/norsh})
1 Number of messages: available=1, already imported=0, retrieved=1, refused=0, errors=1, blacklisted=0
1 Action completed, fully processed
``

Page URL

No response

Steps To reproduce

  1. End User action: Write a support letter.
  2. Action of the support system specialist: add a comment.
  3. End user action: Reply to a comment by mail.
  4. Action of the support system specialist: add a comment.
  5. End user action: Reply to a comment by mail, delete line =-=-=-= To answer by email, write above this line =-=-=-= when writing a response.

Your GLPI setup information

GLPI 9.5.6 ( => /usr/share/glpi)
Installation mode: RPM

Server

Operating system: Linux help.admreg.nov.ru 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64
PHP 8.0.11 apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apcu, bcmath, bz2,
    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, pdo_sqlite, posix, session, shmop, soap, sockets, sodium, sqlite3,
    standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib)
Setup: max_execution_time="600" memory_limit="512M" post_max_size="10500000" safe_mode="" session.save_handler="files"
    upload_max_filesize="10500000" 
Software: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.0.11 ()
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36
Server Software: MariaDB Server
    Server Version: 10.5.12-MariaDB
    Server SQL Mode: 
    Parameters: saglpi@127.0.0.1/glpi
    Host info: 127.0.0.1 via TCP/IP

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
exif extension is installedexif extension is installed
zip extension is installedzip extension is installed
bz2 extension is installedbz2 extension is installed
sodium extension is installedsodium extension is installed
Database version seems correct (10.5.12) - Perfect!Database version seems correct (10.5.12) - 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 /var/lib/glpi/files/_cache has been validated.Write access to /var/lib/glpi/files/_cache has been validated.
Write access to /etc/glpi has been validated.Write access to /etc/glpi has been validated.
Write access to /var/lib/glpi/files/_cron has been validated.Write access to /var/lib/glpi/files/_cron has been validated.
Write access to /var/lib/glpi/files has been validated.Write access to /var/lib/glpi/files has been validated.
Write access to /var/lib/glpi/files/_dumps has been validated.Write access to /var/lib/glpi/files/_dumps has been validated.
Write access to /var/lib/glpi/files/_graphs has been validated.Write access to /var/lib/glpi/files/_graphs has been validated.
Write access to /var/lib/glpi/files/_lock has been validated.Write access to /var/lib/glpi/files/_lock has been validated.
Write access to /var/lib/glpi/files/_pictures has been validated.Write access to /var/lib/glpi/files/_pictures has been validated.
Write access to /var/lib/glpi/files/_plugins has been validated.Write access to /var/lib/glpi/files/_plugins has been validated.
Write access to /var/lib/glpi/files/_rss has been validated.Write access to /var/lib/glpi/files/_rss has been validated.
Write access to /var/lib/glpi/files/_sessions has been validated.Write access to /var/lib/glpi/files/_sessions has been validated.
Write access to /var/lib/glpi/files/_tmp has been validated.Write access to /var/lib/glpi/files/_tmp has been validated.
Write access to /var/lib/glpi/files/_uploads has been validated.Write access to /var/lib/glpi/files/_uploads has been validated.
Write access to /var/lib/glpi/files/_marketplace has been validated.Write access to /var/lib/glpi/files/_marketplace has been validated.
SELinux configuration is OK.SELinux configuration is OK.

GLPI constants

GLPI_ROOT: /usr/share/glpi
GLPI_CONFIG_DIR: /etc/glpi
GLPI_HTMLAWED: /usr/share/glpi/vendor/htmlawed/htmlawed/htmLawed.php
GLPI_MARKETPLACE_DIR: /var/lib/glpi/files/_marketplace
GLPI_VAR_DIR: /var/lib/glpi/files
GLPI_LOG_DIR: /var/log/glpi
GLPI_FONT_FREESANS: /usr/share/fonts/gnu-free/FreeSans.ttf
GLPI_SYSTEM_CRON: 1
GLPI_INSTALL_MODE: RPM
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_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/lib/glpi/files
GLPI_CACHE_DIR: /var/lib/glpi/files/_cache
GLPI_CRON_DIR: /var/lib/glpi/files/_cron
GLPI_DUMP_DIR: /var/lib/glpi/files/_dumps
GLPI_GRAPH_DIR: /var/lib/glpi/files/_graphs
GLPI_LOCAL_I18N_DIR: /var/lib/glpi/files/_locales
GLPI_LOCK_DIR: /var/lib/glpi/files/_lock
GLPI_PICTURE_DIR: /var/lib/glpi/files/_pictures
GLPI_PLUGIN_DOC_DIR: /var/lib/glpi/files/_plugins
GLPI_RSS_DIR: /var/lib/glpi/files/_rss
GLPI_SESSION_DIR: /var/lib/glpi/files/_sessions
GLPI_TMP_DIR: /var/lib/glpi/files/_tmp
GLPI_UPLOAD_DIR: /var/lib/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: /usr/share/glpi/locales
GLPI_VERSION: 9.5.6
GLPI_SCHEMA_VERSION: 9.5.6
GLPI_MIN_PHP: 7.2.0
GLPI_YEAR: 2021

Libraries

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

LDAP directories

SQL replicas

Not active

Notifications

Way of sending emails: SMTP+TLS (anonymous@10.10.1.72)

Mails receivers

Name: 'XXX@XXX.ru' Active: Yes
    Server: '{10.10.1.72/imap/ssl/novalidate-cert/norsh}' Login: 'XXX@XXX.ru' Password: Yes

Plugins list

    news                 Name: Alerts                         Version: 1.9.0      State: Enabled
    behaviors            Name: Behaviours                     Version: 2.5.0      State: Enabled
    dashboard            Name: Dashboard                      Version: 1.0.2      State: Enabled
    escalade             Name: Escalation                     Version: 2.6.2      State: Enabled
    formcreator          Name: Form Creator                   Version: 2.12.2     State: Enabled
    mreporting           Name: More Reporting                 Version: 1.7.3      State: Enabled
    moreticket           Name: More ticket                    Version: 1.6.1      State: Enabled
    mydashboard          Name: My Dashboard                   Version: 1.8.2      State: Enabled
    mycustomview         Name: MyCustomView                   Version: 1.2.1      State: Enabled
    ocsinventoryng       Name: OCS Inventory NG               Version: 1.7.3      State: Enabled
    reports              Name: Reports                        Version: 1.14.1     State: Enabled
    screenshot           Name: Screenshot                     Version: 1.1.4      State: Enabled

OCS Inventory NG
Host: 10.10.0.72
Connection: Ok
Use the OCSNG software dictionary: Yes

Anything else?

No response

cedric-anne commented 3 years ago

Hi,

Please try to reproduce with no active plugin, especially "behaviors".

Regards

BorisNovg commented 3 years ago

The error is reproduced on the test copy of the production server. No active plugins. glpi-comment-3

Error window on Home-Setup-Receivers-XXX@XXX.ru-Actions-Get email tickets now (Debug mode enabled): glpi-comment-2

Problem message (format of message is plain text):

Subject: Re: [GLPI #0060738] test only

Comment LAST
[19-10-2021 15:33] glpi glpi
Comment 3
[19-10-2021 15:32] t.t.test
Comment 2
[19-10-2021 15:30] glpi glpi
Comment 1

Automatically generated by GLPI

=_=_=_= To answer by email, write under this line =_=_=_= 

EML of message:

Received: from xxx.ru (10.10.1.72) by xxx.ru
 (10.10.1.72) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.2176.2 via Mailbox
 Transport; Tue, 19 Oct 2021 15:34:11 +0300
Received: from xxx.ru (10.10.1.72) by xxx.ru
 (10.10.1.72) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.2176.2; Tue, 19
 Oct 2021 15:34:11 +0300
Received: from xxx.ru ([10.10.1.72]) by xxx.ru
 ([10.10.1.72]) with mapi id 15.01.2176.009; Tue, 19 Oct 2021 15:34:11 +0300
From: xxx2 <xxx2@xxx.ru>
To: =?koi8-r?B?88zV1sLBINDPxMTF0tbLyQ==?= <xxx@xxx.ru>
Subject: Re: [GLPI #0060738] test only
Thread-Topic: [GLPI #0060738] test only
Thread-Index: AdfE6ef/aeKfL6aVQPWz8p1zRX3loA==
Date: Tue, 19 Oct 2021 15:34:11 +0300
Message-ID: <ad5d5792c66349e49ac339476a8a35ff@novreg.ru>
Accept-Language: en-US, ru-RU
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 04
X-MS-Exchange-Organization-AuthSource: xxx.ru
X-MS-Has-Attach:
X-MS-Exchange-Organization-Network-Message-Id:
        8ff4b964-d172-49ad-71ac-08d992e406c3
X-MS-Exchange-Organization-SCL: -1
X-MS-TNEF-Correlator:
X-MS-Exchange-Organization-RecordReviewCfmType: 0
Content-Type: text/plain; charset="koi8-r"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

Comment LAST
[19-10-2021 15:33] glpi glpi
Comment 3
[19-10-2021 15:32] t.t.test
Comment 2
[19-10-2021 15:30] glpi glpi
Comment 1

Automatically generated by GLPI

=3D_=3D_=3D_=3D To answer by email, write under this line =3D_=3D_=3D_=3D=20

Additionally, if I add a solution to the ticket, after which I transfer the status of the ticket to Closed, glpi-comment-4

the letter is immediately processed without error: glpi-comment-5

A new ticket is created based on a letter with a comment: glpi-comment-6

and linked with previous ticket: glpi-comment-7

BorisNovg commented 3 years ago

Due to the lack of discussion, I will add a debugging attempt. I enter commands to output the $input variable and backtrace: https://github.com/glpi-project/glpi/blob/e5e117787d28bf0e58a55948ac65d299f6ca7feb/inc/itilfollowup.class.php#L399-L401 ...... Toolbox::logError($input); Toolbox::backtrace();

php-errors.log: (real internet addresses have been replaced with xxx)

[2021-10-20 11:43:32] glpiphplog.ERROR: ITILFollowup::prepareInputForAdd() in /usr/share/glpi/inc/itilfollowup.class.php line 401
Array
  (
      [_blacklisted] => 
      [_mailgate] => 1
      [_uid] => 3
      [_filename] => Array
          (
          )

      [_tag] => 
      [_users_id_requester] => 127
      [_users_id_requester_notif] => Array
          (
              [use_notification] => Array
                  (
                      [0] => 1
                  )

          )

      [users_id] => 127
      [_auto_import] => 1
      [_do_not_check_users_id] => 1
      [_message] => Laminas\Mail\Storage\Message Object
          (
              [flags:protected] => Array
                  (
                      [\Seen] => \Seen
                  )

              [headers:protected] => Laminas\Mail\Headers Object
                  (
                      [headerLocator:Laminas\Mail\Headers:private] => Laminas\Mail\Header\HeaderLocator Object
                          (
                              [plugins:Laminas\Mail\Header\HeaderLocator:private] => Array
                                  (
                                      [bcc] => Laminas\Mail\Header\Bcc
                                      [cc] => Laminas\Mail\Header\Cc
                                      [contentdisposition] => Laminas\Mail\Header\ContentDisposition
                                      [content_disposition] => Laminas\Mail\Header\ContentDisposition
                                      [content-disposition] => Laminas\Mail\Header\ContentDisposition
                                      [contenttype] => Laminas\Mail\Header\ContentType
                                      [content_type] => Laminas\Mail\Header\ContentType
                                      [content-type] => Laminas\Mail\Header\ContentType
                                      [contenttransferencoding] => Laminas\Mail\Header\ContentTransferEncoding
                                      [content_transfer_encoding] => Laminas\Mail\Header\ContentTransferEncoding
                                      [content-transfer-encoding] => Laminas\Mail\Header\ContentTransferEncoding
                                      [date] => Laminas\Mail\Header\Date
                                      [from] => Laminas\Mail\Header\From
                                      [in-reply-to] => Laminas\Mail\Header\InReplyTo
                                      [message-id] => Laminas\Mail\Header\MessageId
                                      [mimeversion] => Laminas\Mail\Header\MimeVersion
                                      [mime_version] => Laminas\Mail\Header\MimeVersion
                                      [mime-version] => Laminas\Mail\Header\MimeVersion
                                      [received] => Laminas\Mail\Header\Received
                                      [references] => Laminas\Mail\Header\References
                                      [replyto] => Laminas\Mail\Header\ReplyTo
                                      [reply_to] => Laminas\Mail\Header\ReplyTo
                                      [reply-to] => Laminas\Mail\Header\ReplyTo
                                      [sender] => Laminas\Mail\Header\Sender
                                      [subject] => Laminas\Mail\Header\Subject
                                      [to] => Laminas\Mail\Header\To
                                  )

                          )

                      [pluginClassLoader:protected] => 
                      [headersKeys:protected] => Array
                          (
                              [0] => mimeversion
                              [1] => received
                              [2] => received
                              [3] => received
                              [4] => from
                              [5] => to
                              [6] => subject
                              [7] => threadtopic
                              [8] => threadindex
                              [9] => xmsexchangemessagesentrepresentingtype
                              [10] => date
                              [11] => messageid
                              [12] => acceptlanguage
                              [13] => contentlanguage
                              [14] => xmsexchangeorganizationauthas
                              [15] => xmsexchangeorganizationauthmechanism
                              [16] => xmsexchangeorganizationauthsource
                              [17] => xmshasattach
                              [18] => xmsexchangeorganizationnetworkmessageid
                              [19] => xmsexchangeorganizationscl
                              [20] => xmstnefcorrelator
                              [21] => xmsexchangeorganizationrecordreviewcfmtype
                              [22] => contenttype
                              [23] => contenttransferencoding
                          )

                      [headers:protected] => Array
                          (
                              [0] => Laminas\Mail\Header\MimeVersion Object
                                  (
                                      [version:protected] => 1.0
                                  )

                              [1] => Laminas\Mail\Header\Received Object
                                  (
                                      [value:protected] => from xxx.ru (10.10.1.72) by xxx.ru (10.10.1.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.2176.2 via Mailbox Transport; Tue, 19 Oct 2021 12:37:11 +0300
                                  )

                              [2] => Laminas\Mail\Header\Received Object
                                  (
                                      [value:protected] => from xxx.ru (10.10.1.72) by xxx.ru (10.10.1.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.2176.2; Tue, 19 Oct 2021 12:37:11 +0300
                                  )

                              [3] => Laminas\Mail\Header\Received Object
                                  (
                                      [value:protected] => from xxx.ru ([10.10.1.72]) by xxx.ru ([10.10.1.72]) with mapi id 15.01.2176.009; Tue, 19 Oct 2021 12:37:11 +0300
                                  )

                              [4] => Laminas\Mail\Header\From Object
                                  (
                                      [fieldName:protected] => From
                                      [addressList:protected] => Laminas\Mail\AddressList Object
                                          (
                                              [addresses:protected] => Array
                                                  (
                                                      [xxx2@xxx.ru] => Laminas\Mail\Address Object
                                                          (
                                                              [comment:protected] => 
                                                              [email:protected] => xxx2@xxx.ru
                                                              [name:protected] => xxx
                                                          )

                                                  )

                                          )

                                      [encoding:protected] => ASCII
                                  )

                              [5] => Laminas\Mail\Header\To Object
                                  (
                                      [fieldName:protected] => To
                                      [addressList:protected] => Laminas\Mail\AddressList Object
                                          (
                                              [addresses:protected] => Array
                                                  (
                                                      [xxx@xxx.ru] => Laminas\Mail\Address Object
                                                          (
                                                              [comment:protected] => 
                                                              [email:protected] => xxx@xxx.ru
                                                              [name:protected] => Служба поддержки
                                                          )

                                                  )

                                          )

                                      [encoding:protected] => UTF-8
                                  )

                              [6] => Laminas\Mail\Header\Subject Object
                                  (
                                      [subject:protected] => Re: [GLPI #0060738] test only
                                      [encoding:protected] => 
                                  )

                              [7] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => Thread-Topic
                                      [fieldValue:protected] => [GLPI #0060738] test only
                                      [encoding:protected] => ASCII
                                  )

                              [8] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => Thread-Index
                                      [fieldValue:protected] => AdfFhxB50MN4UsuKRjOtXA8gWpgZ3g==
                                      [encoding:protected] => ASCII
                                  )

                              [9] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-Exchange-MessageSentRepresentingType
                                      [fieldValue:protected] => 1
                                      [encoding:protected] => ASCII
                                  )

                              [10] => Laminas\Mail\Header\Date Object
                                  (
                                      [value:protected] => Tue, 19 Oct 2021 12:37:11 +0300
                                  )

                              [11] => Laminas\Mail\Header\MessageId Object
                                  (
                                      [messageId:protected] => <ad5d5792c66349e49ac339476a8a35ff@xxx.ru>
                                  )

                              [12] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => Accept-Language
                                      [fieldValue:protected] => en-US, ru-RU
                                      [encoding:protected] => ASCII
                                  )

                              [13] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => Content-Language
                                      [fieldValue:protected] => en-US
                                      [encoding:protected] => ASCII
                                  )

                              [14] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-Exchange-Organization-AuthAs
                                      [fieldValue:protected] => Internal
                                      [encoding:protected] => ASCII
                                  )

                              [15] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-Exchange-Organization-AuthMechanism
                                      [fieldValue:protected] => 04
                                      [encoding:protected] => ASCII
                                  )

                              [16] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-Exchange-Organization-AuthSource
                                      [fieldValue:protected] => xxx.ru
                                      [encoding:protected] => ASCII
                                  )

                              [17] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-Has-Attach
                                      [fieldValue:protected] => 
                                      [encoding:protected] => ASCII
                                  )

                              [18] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-Exchange-Organization-Network-Message-Id
                                      [fieldValue:protected] => 8ff4b964-d172-49ad-71ac-08d992e406c3
                                      [encoding:protected] => ASCII
                                  )

                              [19] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-Exchange-Organization-SCL
                                      [fieldValue:protected] => -1
                                      [encoding:protected] => ASCII
                                  )

                              [20] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-TNEF-Correlator
                                      [fieldValue:protected] => 
                                      [encoding:protected] => ASCII
                                  )

                              [21] => Laminas\Mail\Header\GenericHeader Object
                                  (
                                      [fieldName:protected] => X-MS-Exchange-Organization-RecordReviewCfmType
                                      [fieldValue:protected] => 0
                                      [encoding:protected] => ASCII
                                  )

                              [22] => Laminas\Mail\Header\ContentType Object
                                  (
                                      [type:protected] => text/plain
                                      [encoding:protected] => ASCII
                                      [parameters:protected] => Array
                                          (
                                              [charset] => koi8-r
                                          )

                                  )

                              [23] => Laminas\Mail\Header\ContentTransferEncoding Object
                                  (
                                      [transferEncoding:protected] => quoted-printable
                                      [parameters:protected] => Array
                                          (
                                          )

                                  )

                          )

                      [encoding:protected] => ASCII
                  )

              [content:protected] => 
              [topLines:protected] => 
              [parts:protected] => Array
                  (
                  )

              [countParts:protected] => 
              [iterationPos:protected] => 1
              [mail:protected] => Laminas\Mail\Storage\Imap Object
                  (
                      [protocol:protected] => Laminas\Mail\Protocol\Imap Object
                          (
                              [socket:protected] => Resource id #13
                              [tagCount:protected] => 7
                              [novalidatecert:protected] => 1
                          )

                      [currentFolder:protected] => Test
                      [delimiter:protected] => 
                      [has:protected] => Array
                          (
                              [uniqueid] => 1
                              [delete] => 
                              [create] => 
                              [top] => 
                              [fetchPart] => 1
                              [flags] => 1
                          )

                      [iterationPos:protected] => 2
                      [iterationMax:protected] => 1
                      [messageClass:protected] => Laminas\Mail\Storage\Message
                  )

              [messageNum:protected] => 1
          )

      [content] => 
      [_supplier_email] => 
      [name] => Re: [GLPI #0060738] test only
      [add_reopen] => 1
      [requesttypes_id] => 2
      [itemtype] => Ticket
      [items_id] => 60738
      [_no_history] => 
      [_job] => Ticket Object
          (
              [dohistory] => 1
              [userlinkclass] => Ticket_User
              [grouplinkclass] => Group_Ticket
              [supplierlinkclass] => Supplier_Ticket
              [userentity_oncreate:protected] => 1
              [hardwaredatas] => Array
                  (
                  )

              [computerfound] => 0
              [users:protected] => Array
                  (
                      [1] => Array
                          (
                              [0] => Array
                                  (
                                      [id] => 125674
                                      [tickets_id] => 60738
                                      [users_id] => 127
                                      [type] => 1
                                      [use_notification] => 1
                                      [alternative_email] => 
                                  )

                          )

                      [2] => Array
                          (
                              [0] => Array
                                  (
                                      [id] => 125675
                                      [tickets_id] => 60738
                                      [users_id] => 2
                                      [type] => 2
                                      [use_notification] => 1
                                      [alternative_email] => 
                                  )

                          )

                  )

              [groups:protected] => Array
                  (
                  )

              [suppliers:protected] => Array
                  (
                  )

              [notificationqueueonaction] => 1
              [fields] => Array
                  (
                      [id] => 60738
                      [entities_id] => 2
                      [name] => test only
                      [date] => 2021-10-19 15:29:29
                      [closedate] => 
                      [solvedate] => 
                      [date_mod] => 2021-10-20 10:47:21
                      [users_id_lastupdater] => 2
                      [status] => 2
                      [users_id_recipient] => 127
                      [requesttypes_id] => 2
                      [content] => &lt;div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: #000000; font-family: Calibri,Helvetica,sans-serif;"&gt;&lt;p&gt;test only&lt;/p&gt;&lt;/div&gt;
                      [urgency] => 3
                      [impact] => 3
                      [priority] => 3
                      [itilcategories_id] => 115
                      [type] => 2
                      [global_validation] => 1
                      [slas_id_ttr] => 7
                      [slas_id_tto] => 0
                      [slalevels_id_ttr] => 7
                      [time_to_resolve] => 2021-10-21 15:22:22
                      [time_to_own] => 
                      [begin_waiting_date] => 
                      [sla_waiting_duration] => 13973
                      [ola_waiting_duration] => 0
                      [olas_id_tto] => 0
                      [olas_id_ttr] => 0
                      [olalevels_id_ttr] => 0
                      [ola_ttr_begin_date] => 
                      [internal_time_to_resolve] => 
                      [internal_time_to_own] => 
                      [waiting_duration] => 13973
                      [close_delay_stat] => 0
                      [solve_delay_stat] => 0
                      [takeintoaccount_delay_stat] => 35
                      [actiontime] => 0
                      [is_deleted] => 0
                      [locations_id] => 0
                      [validation_percent] => 0
                      [date_creation] => 2021-10-19 15:29:29
                  )

              [history_blacklist] => Array
                  (
                  )

              [auto_message_on_action] => 1
              [no_form_page] => 
              [additional_fields_for_dictionnary] => Array
                  (
                  )

              [fkfield:protected] => 
              [searchopt:protected] => 
              [taborientation] => vertical
              [get_item_to_display_tab] => 1
              [usenotepad:protected] => 
              [type:protected] => -1
              [displaylist:protected] => 1
              [showdebug] => 
          )

      [_close] => 0
      [is_private] => 0
  )
   {"user":"2@xxx.ru"} 
2021-10-20 11:43:32 [2@xxx.ru]
  Backtrace :
  inc/itilfollowup.class.php:401                     Toolbox::backtrace()
  inc/commondbtm.class.php:1129                      ITILFollowup->prepareInputForAdd()
  inc/mailcollector.class.php:889                    CommonDBTM->add()
  front/mailcollector.form.php:88                    MailCollector->collect()

Backtrace: inc/itilfollowup.class.php:401 Toolbox::backtrace() https://github.com/glpi-project/glpi/blob/e5e117787d28bf0e58a55948ac65d299f6ca7feb/inc/itilfollowup.class.php#L399-L401

inc/commondbtm.class.php:1129 ITILFollowup->prepareInputForAdd() https://github.com/glpi-project/glpi/blob/e5e117787d28bf0e58a55948ac65d299f6ca7feb/inc/commondbtm.class.php#L1118-L1130

inc/mailcollector.class.php:889 CommonDBTM->add() https://github.com/glpi-project/glpi/blob/e5e117787d28bf0e58a55948ac65d299f6ca7feb/inc/mailcollector.class.php#L879-L895

front/mailcollector.form.php:88 MailCollector->collect() https://github.com/glpi-project/glpi/blob/e5e117787d28bf0e58a55948ac65d299f6ca7feb/front/mailcollector.form.php#L86-L88

Maybe this will help you find the source of the problem.

cedric-anne commented 3 years ago

Hi,

Unless I am wrong, this is not a bug.

When the email is parsed, we try to detect these lines:

  1. If both are found, we strip the content between them.
  2. If only HEADER is found, content from HEADER to end of mail is stripped.
  3. If only FOOTER is found, content from beginning of the message to FOOTER is stripped.

I guess you are in case 3, so as content is only whitespace after the FOOTER line, it considers that content is empty, and it rejects the solution.

Regards

cedric-anne commented 3 years ago

See https://github.com/glpi-project/glpi/blob/9.5/bugfixes/inc/mailcollector.class.php#L1117 for related code.

BorisNovg commented 3 years ago

Judging by the contents of the content field, this problematic message is treated as empty.

      [content] => 
      [_supplier_email] => 
      [name] => Re: [GLPI #0060738] test only
      [add_reopen] => 1

A separate oddity is that when creating a new ticket, the text in the Description field is present! glpi-comment-6

As an addition, I sent an empty message and the reaction was exactly the same: If you reject the solution, you must specify a reason.


Accordingly, the problem narrows down to the reaction to an empty message - such a message is not deleted and hangs in the Inbox!

This is wrong.

cedric-anne commented 3 years ago

Accordingly, the problem narrows down to the reaction to an empty message - such a message is not deleted and hangs in the Inbox!

You are right, it may cause issues. When a ticket or a followup add operation returns a falsy result, which happens in this case, it is considered as an error (NotImportedEmail::FAILED_OPERATION), but email is not moved into the refused folder. It is not so easy, right now to know why the add operation failed.

In the collector cofiguration, you can use the Collect only unread mail configuration. It should prevent this kind of message to be fetched each time.

BorisNovg commented 3 years ago

Specified the problem more precisely:

An empty message sent by e-mail as a comment to the ticket creates an error in the mail receiver, is not deleted and hangs in the Inbox, there is an error "If you reject the solution, you must specify a reason" in the log even if the ticket does not have a solution yet.

Steps To reproduce

  1. End User action: Write a support letter.
  2. Action of the support system specialist: add a comment.
  3. End user action: Reply to a comment by empty mail.

My proposed solution method

If a message is received by a mail receiver (not via the GLPI web interface) with empty content (or with content in which there is no informative part left after the quote has been deleted):

if the ticket does not yet contain a solution, the content should be replaced with the text "(Empty message)".

if the ticket already contains a solution (but has not yet been closed), the content should be replaced with the text "(If you reject the solution, you must specify a reason)", while the ticket status should be kept unchanged (Solved) and the last solution should not be rejected.

The goal is to inform the user by e-mail the result of his request (now in the current version of GLPI the user who sent the request by e-mail does not receive any feedback by e-mail or in the GLPI web interface, the information is recorded in the log where only the administrator can see it, but not the end user).

k0xak commented 2 years ago

I dont get it.

We have fully working 9.4 where email followup works. When we upgrade to 9.5 emial followups stops to work and emails are stuck in inbox

Created emails are same, we reply in same way - it just down work. Even "=-=-=-= To answer by email, write above this line =-=-=-=" exists in the reply.

Mailgate response: If you reject the solution, you must specify a reason

BorisNovg commented 2 years ago

Created emails are same, we reply in same way - it just down work. Even "=-=-=-= To answer by email, write above this line =-=-=-=" exists in the reply. Mailgate response: If you reject the solution, you must specify a reason

k0xak, I think the reason for the "If you reject the solution, you must specify a reason" response is that the message handler concludes that a BLANK letter has arrived at glpi. And this conclusion is made due to the fact that the letter does not contain the line "=_=_=_= To answer by email, write under this line =_=_=_=", meaning the end of the quote. The response "If you reject the solution, you must specify a reason" is output precisely as a reaction to an EMPTY incoming message.

Tip - Look for the reason why "=-=-=-= To answer by email, write above this line =-=-=-=" is present in messages and "=_=_=_= To answer by email, write under this line =_=_=_=" is missing. Most likely, you should pay the attention of users so that when responding to a message from glpi, they do not delete the "unnecessary" message tail along with the line "=_=_=_= To answer by email, write under this line =_=_=_=". Alternatively, they can remove the "unnecessary" tail, but strictly ensure that the string "=_=_=_= To answer by email, write under this line =_=_=_=" remains in the response (not deleted by the user).

cconard96 commented 2 years ago

Related to #10792 Proposed fix for GLPI 10 (done for next major version because it is a change in expected behavior): #10797

cconard96 commented 2 years ago

Fix #10797 was merged and will be included with 10.1.0.