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

Moblog gets Subject wrong with MS-Exchange-AntiSpam #3721

Open
robinsowell opened this issue Aug 23, 2023 · 2 comments
Open

Moblog gets Subject wrong with MS-Exchange-AntiSpam #3721

robinsowell opened this issue Aug 23, 2023 · 2 comments
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.

Comments

@robinsowell
Copy link
Contributor

Meh - so Moblog continues to chug along like the good little add-on it is, BUT it can get the subject wrong in some cases. In this instance, all the subjects come back looking like

Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; yada yada

Which is amazingly enough, not the actual title.

Here we figure out the subject via some regex:

if (preg_match("/Subject:(.*)/", trim($email_data), $subject)) {

Problem is, some ms exchange spam tool is playing amongst the headers, so now we have 3 matches for that Subject: search:

h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6Fi1Ds7JtqnV5/SDDOJApb0g5STf/sdVrqUVvCBYa78=; b=Ffc4C/OzApthIhoz4bVs7WhaTlC5ncU1D1KD/OntPWlDHDmwKMRiXD/E9r1e/NWUPj0dR6XdSi5xSMxYDCBNvOv0++x4+cnliIkTZGSagnHxSi2GXhJ2KO7CqbTV2SopHWeVJ4KmICI5dABDEJpn6x8KpEyvCG0jm0D55k++UJPjfs/dDHpBLppwY3NkrX+pjq9nJdQdv+YklqXgK7QR4jiI1g/MsrxLzOjzdXPRx6vwdScc3rOiCXY6mPCpbJTOtr3glStqX2TZbrx7D8IKMlm5CuZilI8rz2E5OA5x1Hnf09/nDtCRmzDltHvFB8rU74TQhqRqknCE8Wl4yl1stQ==

From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6Fi1Ds7JtqnV5/SDDOJApb0g5STf/sdVrqUVvCBYa78=; b=N6NdVyl4sx1WCBGfTw5ovgJdUsG44sHKJ2pLhTGzSi28a9b/DXxdpYSdgj3tuB11Nhfi/WpIa4ov2T54vZymP5nTvVTbRMeVu32Bj9QvQl76mUIccURWskDpnpVmrNz7V3PlG2b72VmTTJm7K2+R92/mdDeaBxMGnk647Gbs1XspyT7OZ9PwsJ1OhfB24DUQ9SMCUki3MAPdMIVBjymo2JxE

Subject: Test moblog

I think we just need a tweak to the regex, but I stink at regex. Nick got it working by doing

if (preg_match("/Thread-Topic:(.*)/", trim($email_data), $subject)) {

But I'm not dead sure what's the best option. Could use a tweak, though. I suspect we'll see more of these over time.

@robinsowell robinsowell added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label Aug 23, 2023
@intoeetive
Copy link
Contributor

intoeetive commented Aug 25, 2023

@robinsowell I think this is the regex, but depending on the order of headers it might actually return wrong result still

if (preg_match("/(?:Thread-Topic|Subject):(.*)/", trim($email_data), $subject)) {

I think what we need is to check for Thread-Topic first and if it does not exist or is empty, then fall back to Subject

Unfortunately I have no way to test this, so this really falls into your plate )

@intoeetive
Copy link
Contributor

@robinsowell also, do you think this could be the same issue? #1347

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.
Projects
None yet
Development

No branches or pull requests

2 participants