(I have deleted and rewritten the post, as I have made various edits during the day - but now it should fit :-) )
@KevinTheJedi
Here are the header details from the ticket mail.
It was again created in the standard department (sun.company@domain.de). In the data I can see that there is a "for"-section within the received tag, where the correct address (moon.company@domain.de) that the sender entered in the BCC field is available. So the information does arrive and you can recognize to which of the various ticket e-mail accounts the e-mail was sent despite BCC, but it seems not handled by osTicket. As far as I can see from the code, it only tries to search for To, CC and delivered-to and thus recognize a BCC recipient, but not all mail processors provide this in the header data. And since no e-mail address from the osTicket system is recognizable in the "To" field, the default address/department is used.
I have seen in the osTicket code, if I am correct, but I have too little knowledge of the fact that the system also searches for a “BCC” field in addition to the “To” field when retrieving emails from the account - but this does not exist in the header data, which is probably why the wrong information is used in the “To” field. I think so!
However, the necessary information with the correct address is only provided in the received-tag in the "for"-section. This contains the email to which it was originally sent and was entered in the BCC field. In my opinion, this field should be taken, because it seems to be the only correct one where the information is written if the e-mail address was only written to BCC.
Return-Path: <from@domain.com>
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on
dd50130.kasserver.com
X-Original-To: moon.company@domain.com
Delivered-To: m06a161f@dd50130.kasserver.com
Authentication-Results: dd50130.kasserver.com;
dkim=pass (2048-bit key; unprotected) header.d=me.com header.i=@me.com header.a=rsa-sha256 header.s=1a1hai header.b=uJsMpXxx;
dkim-atps=neutral
Received: from outbound.qs.icloud.com (p-east3-cluster2-host12-snip4-2.eps.apple.com [57.103.87.243])
by dd50130.kasserver.com (Postfix) with ESMTPS id 703121C018DB
for <moon.company@domain.com>; Mon, 2 Jun 2025 06:39:05 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai;
bh=fdkeB/A0FkbVP2k4J4pNPoeWH6vqBm9+b0C3OY87Cw8=;
h=From:Content-Type:Mime-Version:Date:Subject:Message-Id:To:x-icloud-hme;
b=uJsMpXxxEQ16Ec26B1j3AJXKIjnRrPmh5fhj9ziJBMW71UFovO+M1hz5gQsj1f+vo
ar6dX1iMlc45gGWAV6YWkwQ8a3pJwcHOhbdhLTQXiIZ7AYW1i/9mUfJaYIC37DRGvY
Hqk2WipTrBdA7cyWrAhpYuIj4uc7IyRN18SARdGQgZhiq5LD8o0tGkGMQyNcJRFXde
ebu8AB3X/qWy/bs5+qJZWLk54yyFAr3Um8YMhY8301tmZBVc8bzJoD4sCGx2cNfjW9
TiCAkwD4WElNqwst3jl5WH7Bdsj2zQpopVz3b2FJfZCC9FGyFDhjzkTrH7WLqyn53T
Ot9ZvMNoaC/2Q==
Received: from outbound.qs.icloud.com (localhost [127.0.0.1])
by outbound.qs.icloud.com (Postfix) with ESMTPS id 2520518001EC;
Mon, 2 Jun 2025 04:39:01 +0000 (UTC)
Received: from smtpclient.apple (qs-asmtp-me-k8s.p00.prod.me.com [17.57.155.37])
by outbound.qs.icloud.com (Postfix) with ESMTPSA id 2DFBB180014B;
Mon, 2 Jun 2025 04:39:01 +0000 (UTC)
From: name <from@domain.com>
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\))
Date: Mon, 2 Jun 2025 06:38:59 +0200
Subject: BCC Test
Message-Id: <F6EB704D-08A1-40E8-81CB-85202E1E7F54@me.com>
To: name <from@domain.com>
X-Mailer: Apple Mail (2.3826.600.51.1.1)
X-Proofpoint-GUID: -WdR554zunKvGRnNP2zbVE74syAR6dyZ
X-Proofpoint-ORIG-GUID: -WdR554zunKvGRnNP2zbVE74syAR6dyZ
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40
definitions=2025-06-02_01,2025-05-30_01,2025-03-28_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0
phishscore=0 spamscore=0 clxscore=1015 suspectscore=0 adultscore=0 mlxscore=0
malwarescore=0 mlxlogscore=688 classifier=spam adjust=0 reason=mlx
scancount=1 engine=8.22.0-2503310001 definitions=main-2506020036
X-Spamd-Bar: /
X-Dmarc-Test: Allow
X-KasLoop: m06a161f