osTicket-Version v1.18.1 (0375576)
Server-Software Apache/2.4.62 (Debian)
MySQL-Version 10.11.6
PHP-Version 8.3.14

I understand that PHP 8.3 is not officially supported yet, but I believe the issue is unrelated to the PHP version.

From time to time, I encounter the following error:

Excessive errors processing emails for ssl://mymailserver:995/POP (mymailservername <mymailaddress>).
Please manually check the Fetch Folder () [1/30 - 0/1]

Excessive errors processing emails

The osTicket log (in debug mode) shows:

Mail Fetcher
Invalid header value detected

I am aware that a quick solution is to manually delete the problematic email(s) from the mailbox. While this resolves the issue temporarily, it is frustrating to have to delete several emails manually each week.

Since I am using the latest osTicket version, all recommended patches mentioned in this forum have already been applied.

The issue is caused by spam emails. Below is an example of such an email:

Return-Path: return@return.postman.co.kr
Delivered-To: xxx
Received: from xxx (xxx [xxx])
by xxx (Postfix) with ESMTP id B329B1480F76
for <xxx>; Tue, 14 Jan 2025 05:17:34 +0100 (CET)
Authentication-Results: xxx;
dkim=pass (1024-bit key; unprotected) header.d=postman.co.kr header.i=@Postman.co.kr header.b="Y0lWkOYQ";
dkim-atps=neutral
Received: from send24.postman.co.kr (send24.postman.co.kr [119.207.76.24])
by xxx (Postfix) with SMTP id BC7D2A3338
for <xxx>; Tue, 14 Jan 2025 05:17:32 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1736828249;
s=sender; d=postman.co.kr;
h=From:To:Reply-to:Subject😃ate:List-Unsubscribe:Feedback-Id😛recedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
bh=LfA/zocxzF+VgWGDHnRH+EgnFmZRRvFvLG1bjO/N76k=;
b=Y0lWkOYQZrBTstVi8QoIRkNQyrRqqcytoDb6rZaQfGTXd7ec7VYRMegSY/jkrqGV
rx/Vi8K/n2smjvtfMC2YayVRxI2qMiBy6SpmJbaJfQvPLzqHnWWoHi+fNxtIXO08zp7
+4kDlDpdrqwo0/yzAbs/hjHzR0YKde6Gd0LvVJQg=
From: "=?utf-8?B?U29waGll?=" <xxx>
To: "=?utf-8?B?Q1VTVA==?=" <xxx>
Reply-to: <xxx>
Subject: =?utf-8?B?UkVRVUVTVDpBRDgzNjFBUk1aLVJFRUw3?=
Date: Tue, 14 Jan 2025 13:17:29 +0900
X-WORKER_ID: <single.default_Worker_38>
X-MAIL_ID: <UE9TVF9JRD0yMDI1MDExNDAwMDAx>
X-MEMBER_ID: <TV9JRD1jYXRoeS5vbmVyaXZlcl8zNDQwNw==>
X-SEND_TYPE: <U1RZUEU9TUFTUw==>
X-LIST_TABLE: <TElTVF9UQUJMRT1FTVNfTUFTU19TRU5EX0xJU1Q=>
List-Unsubscribe: <mailto:unsubscribe@esp-send.humuson.com?subject=2025011400001^cathy.oneriver_34407>, http://ums.pushpia.cn/ums/deny/unsubscription.jsp?p_id=2025011400001&amp;m_id=cathy.oneriver_34407&amp;chn=em
Feedback-Id: cathy.oneriver:2025011400001:cathy.oneriver_34407:ums
Precedence: bulk
X-Mailer: eMsSMTP Ver6.5( PLUTO-build 0322 )
MIME-Version: 1.0
Message-ID: 202501141317296349@send24.postman.co.kr
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<title></title>
</head>
<body><div style=3D"display:none"><img src=3D"http://ums.pushpia.cn/Check.html?TV9JRD1jYXRoeS5vbmVyaXZlcl8zNDQwNw=3D=3D&U1RZUEU9TUFTUw=3D=3D&TElTVF9UQUJMRT1FTVNfTUFTU19TRU5EX0xJU1Q=3D&UE9TVF9JRD0yMDI1MDExNDAwMDAx&VEM9MjAyNTAyMTM=3D&S0lORD1P" width=3D1 height=3D1></div>
<p>Hello Dear,</p>
<p>Good day!</p>
<p>Hard Find Electronics is the distributor for electronic components and worked in the area more than 10years.</p>
<p>Our service:</p>
<p>1. 365days warranty</p>
<p>2. Hard to find parts</p>
<p>3. Short lead time(2days)</p>
<p>4. Free sample</p>
<p>5. Free shipping.</p>
<p>Our strong line:</p>
<p>IC: Microchip, TI, AD, LT, Xilinx, Maxim...</p>
<p>MLCC capacitors&amp;resistors: Samsung, Murata, Yageo,TDK...</p>
<p>Diodes&amp;Transistors: Vishay, ON, ST, TI, NXP...</p>
<p>Module&amp;Connectors ,Relay: Traco, Hongfa, Omron, TE, Molex...</p>
<p>The below are our hot offer for your reference:</p>
<p>AD8361ARMZ-REEL7 AD 2023+ 8.67usd</p>
<p>AD8314ACPZ-RL7 AD 2021+ 1.28usd</p>
<p>LMH2110TM/NOPB AD 2022+ 4.72usd</p>
<p>PIC16F636-I/SL Microchip 2021+ 1.04usd</p>
<p>PIC12F510-I/SN Microchip 2021+ 0.38usd</p>
<p>PIC16F689-I/SS Microchip 2022+ 1.44usd</p>
<p>TPA3116D2DADR TI 2022+ 0.55usd</p>
<p>TPA3118D2DAPR TI 2022+ 0.63usd</p>
<p>TPA3251D2DDVR TI 2022+ 2.96usd</p>
<p>If you need any parts, Pls send inquires to me.</p>
<p>We will support you the best.<br />
<br />
Best regards=EF=BC=81<br />
Sophie&nbsp; Sales Manager<br />
Hard Find Electronics<br />
315, Shahe Rod, Long Gang District, Shenzhen, CN, 518000<br />
Tel: +86-755-8418 8103&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
Fax: +86-755-8418 8303</p>
</body>
</html>

Does anyone have a suggestion for a permanent fix to this problem?

    sbumba

    Looks like laminas/laminas-mail is having issues parsing one of the headers. I would suspect the List-Unsubscribe header as every URL in said header is supposed to be wrapped with <> (according to RFC 2369). As you can see from your example the second URL is not wrapped properly which could definitely cause parsing issues.

    Of course, this is just me spitballing ideas as I haven't actually tested your example yet. It will be a while until I can get to testing this issue as legacy is currently in maintenance mode.

    Cheers.

      Thanks KevinTheJedi for looking into this.

      I would highly appreciate it if there were an option in osTicket to delete unparsable emails. Ideally, the unparsable email would be forwarded to the ticket admin and then deleted.

      In the meantime, is there any way to implement a quick and dirty fix to avoid being flooded with 'Excessive errors processing emails' messages or modify the PHP code to delete unparsable emails?

        sbumba

        Not off hand. You’d need to make a patch yourself.

        Cheers.

        7 days later

        This error is driving me a little bit crazy.

        Is class.mailfetch.php the right place for a quick-and-dirty hack?

        I assume the processEmails() function is the right place to intervene. I hope modifying the exception handling will do the trick:

        
        catch (\Throwable $t) {
                        // If we have result then exception happened after email
                        // processing and shouldn't count as an error
                        if (!$result)
                            $errors++;
                        // log the exception as a debug message
                        $this->logDebug($t->getMessage());
        
        		// START modified by sbumba
        		// todo send message to admin 
        		// now delete it
        		$this->mbox->removeMessage($i);
        		// END modified by sbumba
                    }

        I will test it if it works next time.

        the quick hack seems to work :-)

        11 days later

        I am also getting "Invalid header value detected" errors. I am sending basic email from Gmail but the tickets are not being added.

        Can someone please guide on how to disable these header checks?

        NB: I have tested with some other email providers and it is working OK. The issue only GMAIL.

        Write a Reply...