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.36k stars 1.3k forks source link

HTML Mail not being parsed correctly #13375

Closed eduardomozart closed 2 years ago

eduardomozart commented 2 years ago

Code of Conduct

Is there an existing issue for this?

Version

10.0.5

Bug description

When sending mail from Windows Live Mail, the ticket is opened but it's HTML isn't parsed, as can be seen at the screenshot below:

image

But when opening tickets from Microsoft Outlook, it renders as expected (only special characters aren't being parsed correctly, e.g. accents aren't being shown. In Brazil, it's common the usage of "latin1 iso-8859-1" as encoding and I believe that GLPI isn't handling it's encoding as it should too):

image

Relevant log output

There's no error reported at GLPI PHP errors and SQL errors (php-error.log and sql-error.log), neither GLPI mail logs (mail*.log) and PHP errors log (php_errors.log).

Here's the first screenshot HTML output (content of the ticket shown at GLPI):

<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>Boa tarde !!</DIV>
<DIV>&nbsp;</DIV>
<DIV>Preciso que libere para usuario elias.p a tela pra liberar pedidos de
assistencia tecnica na expedição.</DIV>
<DIV><BR>Att<BR><BR><BR><BOTTOM left><IMG title=example
style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; BACKGROUND-IMAGE: none; BORDER-BOTTOM: 0px; PADDING-TOP: 0px; PADDING-LEFT: 0px; BORDER-LEFT: 0px; DISPLAY: inline; PADDING-RIGHT: 0px"
border=0 alt=example src="cid:522EC30F495A41FDBE8A8F8A77D31FF2@example.com"
width=644 height=116> </BOTTOM left><BR><BR><FONT size=2><FONT
color=gray>"Qualquer informação contida nesta mensagem, incluindo os seus
eventuais anexos, é destinada exclusivamente à pessoa ou empresa para qual foi
endereçada, podendo conter material confidencial. Qualquer forma de
retransmissão, disseminação, ou uso para outros fins, por pessoas ou empresas
distintas das para qual foi endereçada, é proibido. Caso você tenha recebido
esta mensagem por engano, por favor, retorne-a ao emissor e apague de seus
arquivos." <BR><BR>"Any information contained in this message, including its
eventual annexes, is destined exclusively to the person or company to which it
was addressed to, and it may contain confidential material. Any form of
retransmission, spreading, or use towards other means, by any person or company
other than the addressee is forbidden. In case you have received this message by
mistake, please return it to the sender and delete your files."
</FONT></DIV></FONT></DIV></DIV>

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

<details><summary>Instruções de instalação e configuração</summary><pre>GLPI 10.0.5 ( => C:\inetpub\glpi)
Installation mode: TARBALL
Current language:pt_BR

</details><details><summary>Server</summary><pre> 
Operating system: Windows NT UNIFI 10.0 build 17763 (Windows Server 2016) AMD64
PHP 7.4.33 cgi-fcgi (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apcu, bcmath, bz2, calendar, cgi-fcgi, ctype,
    curl, date, dom, exif, fileinfo, filter, gd, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mysqli, mysqlnd, openssl,
    pcre, readline, session, sodium, standard, tokenizer, xml, xmlreader, xmlwriter, zip, zlib)
Setup: max_execution_time="600" memory_limit="256M" post_max_size="8M" safe_mode="" session.save_handler="files"
    upload_max_filesize="20M" 
Software: Microsoft-IIS/10.0
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
Server Software: MySQL Community Server (GPL)
    Server Version: 5.7.40-log
    Server SQL Mode: STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    Parameters: [Omitted]
    Host info: localhost via TCP/IP

PHP version (7.4.33) 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 (5.7.40) is supported.
No files from previous GLPI version detected.
The log file has been created successfully.
Write access to C:\inetpub\glpi/files/_cache has been validated.
Write access to C:\inetpub\glpi/config has been validated.
Write access to C:\inetpub\glpi/files/_cron has been validated.
Write access to C:\inetpub\glpi/files has been validated.
Write access to C:\inetpub\glpi/files/_dumps has been validated.
Write access to C:\inetpub\glpi/files/_graphs has been validated.
Write access to C:\inetpub\glpi/files/_lock has been validated.
Write access to C:\inetpub\glpi/files/_pictures has been validated.
Write access to C:\inetpub\glpi/files/_plugins has been validated.
Write access to C:\inetpub\glpi/files/_rss has been validated.
Write access to C:\inetpub\glpi/files/_sessions has been validated.
Write access to C:\inetpub\glpi/files/_tmp has been validated.
Write access to C:\inetpub\glpi/files/_uploads has been validated.
The following directories should be placed outside "C:\inetpub\glpi":
‣ "C:\inetpub\glpi/files" ("GLPI_VAR_DIR")
‣ "C:\inetpub\glpi\config" ("GLPI_CONFIG_DIR")
You can ignore this suggestion if you are certain that these directories are not accessible through your web server.
Sessions configuration is secured.
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 C:\inetpub\glpi/marketplace has been validated.
Timezones seems loaded in database.

</details><details><summary>GLPI constants</summary><pre> 
GLPI_ROOT: "C:\\inetpub\\glpi"
GLPI_CONFIG_DIR: "C:\\inetpub\\glpi/config"
GLPI_VAR_DIR: "C:\\inetpub\\glpi/files"
GLPI_MARKETPLACE_DIR: "C:\\inetpub\\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: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["/^(https?|feed):\\/\\/[^@:]+(\\/.*)?$/"]
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_ALLOW_OVERRIDE: true
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true
GLPI_USER_AGENT_EXTRA_COMMENTS: ""
GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1"
GLPI_AJAX_DASHBOARD: "1"
GLPI_CALDAV_IMPORT_STATE: 0
GLPI_DEMO_MODE: "0"
GLPI_CENTRAL_WARNINGS: "1"
GLPI_DOC_DIR: "C:\\inetpub\\glpi/files"
GLPI_CACHE_DIR: "C:\\inetpub\\glpi/files/_cache"
GLPI_CRON_DIR: "C:\\inetpub\\glpi/files/_cron"
GLPI_DUMP_DIR: "C:\\inetpub\\glpi/files/_dumps"
GLPI_GRAPH_DIR: "C:\\inetpub\\glpi/files/_graphs"
GLPI_LOCAL_I18N_DIR: "C:\\inetpub\\glpi/files/_locales"
GLPI_LOCK_DIR: "C:\\inetpub\\glpi/files/_lock"
GLPI_LOG_DIR: "C:\\inetpub\\glpi/files/_log"
GLPI_PICTURE_DIR: "C:\\inetpub\\glpi/files/_pictures"
GLPI_PLUGIN_DOC_DIR: "C:\\inetpub\\glpi/files/_plugins"
GLPI_RSS_DIR: "C:\\inetpub\\glpi/files/_rss"
GLPI_SESSION_DIR: "C:\\inetpub\\glpi/files/_sessions"
GLPI_TMP_DIR: "C:\\inetpub\\glpi/files/_tmp"
GLPI_UPLOAD_DIR: "C:\\inetpub\\glpi/files/_uploads"
GLPI_INVENTORY_DIR: "C:\\inetpub\\glpi/files/_inventories"
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: "C:\\inetpub\\glpi/locales"
GLPI_VERSION: "10.0.5"
GLPI_SCHEMA_VERSION: "10.0.5@628dbfbb91eb4caf10c35969d9162b9300b141e0"
GLPI_MARKETPLACE_PRERELEASES: false
GLPI_MIN_PHP: "7.4.0"
GLPI_MAX_PHP: "8.3.0"
GLPI_YEAR: "2022"

</details><details><summary>Libraries</summary><pre> 
htmlawed/htmlawed version 1.2.9 in (C:\inetpub\glpi\vendor\htmlawed\htmlawed)
phpmailer/phpmailer version 6.6.0 in (C:\inetpub\glpi\vendor\phpmailer\phpmailer\src)
simplepie/simplepie version 1.5.8 in (C:\inetpub\glpi\vendor\simplepie\simplepie\library)
tecnickcom/tcpdf version 6.5.0 in (C:\inetpub\glpi\vendor\tecnickcom\tcpdf)
michelf/php-markdown in (C:\inetpub\glpi\vendor\michelf\php-markdown\Michelf)
true/punycode in (C:\inetpub\glpi\vendor\true\punycode\src)
iamcal/lib_autolink in (C:\inetpub\glpi\vendor\iamcal\lib_autolink)
sabre/dav in (C:\inetpub\glpi\vendor\sabre\dav\lib\DAV)
sabre/http in (C:\inetpub\glpi\vendor\sabre\http\lib)
sabre/uri in (C:\inetpub\glpi\vendor\sabre\uri\lib)
sabre/vobject in (C:\inetpub\glpi\vendor\sabre\vobject\lib)
laminas/laminas-i18n in (C:\inetpub\glpi\vendor\laminas\laminas-i18n\src)
laminas/laminas-servicemanager in (C:\inetpub\glpi\vendor\laminas\laminas-servicemanager\src)
monolog/monolog in (C:\inetpub\glpi\vendor\monolog\monolog\src\Monolog)
sebastian/diff in (C:\inetpub\glpi\vendor\sebastian\diff\src)
donatj/phpuseragentparser in (C:\inetpub\glpi\vendor\donatj\phpuseragentparser\src\UserAgent)
elvanto/litemoji in (C:\inetpub\glpi\vendor\elvanto\litemoji\src)
symfony/console in (C:\inetpub\glpi\vendor\symfony\console)
scssphp/scssphp in (C:\inetpub\glpi\vendor\scssphp\scssphp\src)
laminas/laminas-mail in (C:\inetpub\glpi\vendor\laminas\laminas-mail\src\Protocol)
laminas/laminas-mime in (C:\inetpub\glpi\vendor\laminas\laminas-mime\src)
rlanvin/php-rrule in (C:\inetpub\glpi\vendor\rlanvin\php-rrule\src)
blueimp/jquery-file-upload in (C:\inetpub\glpi\vendor\blueimp\jquery-file-upload\server\php)
ramsey/uuid in (C:\inetpub\glpi\vendor\ramsey\uuid\src)
psr/log in (C:\inetpub\glpi\vendor\psr\log\Psr\Log)
psr/simple-cache in (C:\inetpub\glpi\vendor\psr\simple-cache\src)
psr/cache in (C:\inetpub\glpi\vendor\psr\cache\src)
league/csv in (C:\inetpub\glpi\vendor\league\csv\src)
mexitek/phpcolors in (C:\inetpub\glpi\vendor\mexitek\phpcolors\src\Mexitek\PHPColors)
guzzlehttp/guzzle in (C:\inetpub\glpi\vendor\guzzlehttp\guzzle\src)
guzzlehttp/psr7 in (C:\inetpub\glpi\vendor\guzzlehttp\psr7\src)
glpi-project/inventory_format in (C:\inetpub\glpi\vendor\glpi-project\inventory_format\lib\php)
wapmorgan/unified-archive in (C:\inetpub\glpi\vendor\wapmorgan\unified-archive\src)
paragonie/sodium_compat in (C:\inetpub\glpi\vendor\paragonie\sodium_compat\src)
symfony/cache in (C:\inetpub\glpi\vendor\symfony\cache)
html2text/html2text in (C:\inetpub\glpi\vendor\html2text\html2text\src)
symfony/css-selector in (C:\inetpub\glpi\vendor\symfony\css-selector)
symfony/dom-crawler in (C:\inetpub\glpi\vendor\symfony\dom-crawler)
twig/twig in (C:\inetpub\glpi\vendor\twig\twig\src)
twig/string-extra in (C:\inetpub\glpi\vendor\twig\string-extra)
symfony/polyfill-ctype not found
symfony/polyfill-iconv not found
symfony/polyfill-mbstring not found
symfony/polyfill-php80 in (C:\inetpub\glpi\vendor\symfony\polyfill-php80)
symfony/polyfill-php81 in (C:\inetpub\glpi\vendor\symfony\polyfill-php81)
symfony/polyfill-php82 in (C:\inetpub\glpi\vendor\symfony\polyfill-php82)

</details><details><summary>LDAP directories</summary><pre> 
Server: '192.168.0.1', Port: '389', BaseDN: 'dc=example;dc=com', Connection filter:
        '(&(objectClass=user)(objectCategory=person))', RootDN: 'example\administrador', Use TLS: none

</details><details><summary>SQL replicas</summary><pre> 
Not active

</details><details><summary>Notifications</summary><pre> 
Way of sending emails: SMTP (cpd@mail.example.com)

</details><details><summary>Plugins list</summary><pre> 
    actualtime           Name: ActualTime                     Version: 2.0.0      State: Enabled                                 
        Install Method: Manual
    news                 Name: Alertas                        Version: 1.10.5     State: Enabled                                 
        Install Method: Manual
    behaviors            Name: Comportamental                 Version: 2.7.2      State: Enabled                                 
        Install Method: Manual
    pdf                  Name: Imprimir em PDF                Version: 3.0.0      State: Enabled                                 
        Install Method: Manual
    timelineticket       Name: Linha do tempo dos chamados    Version: 10.0+1.1   State: Enabled                                 
        Install Method: Manual
    mailanalyzer         Name: Mail Analyzer                  Version: 3.0.0      State: Enabled                                 
        Install Method: Manual
    ocsinventoryng       Name: OCS Inventory NG               Version: 2.0.3      State: Enabled                                 
        Install Method: Manual
    resources            Name: Recursos humanos               Version: 3.0.4      State: Enabled                                 
        Install Method: Manual
    reports              Name: Relatórios                     Version: 1.16.0     State: Enabled                                 
        Install Method: Manual
    reservation          Name: Reservation                    Version: 2.4.1      State: Enabled                                 
        Install Method: Manual

</pre></details>

Anything else?

Please let me know if there's anymore information I can provide to troubleshoot/fix this issue.

cedric-anne commented 2 years ago

Hi,

Could you check if #13376 fixes your issue ?

Regards

eduardomozart commented 2 years ago

Hello @cedric-anne, Thank you for your fast response. Applied your fix. I'll gonna have to wait tomorrow to test it because it's already end of working hours here on my country.

eduardomozart commented 2 years ago

I can confirm that this commit fixes the issue.