Page MenuHomePhorge

Make incoming mail handling more robust / correct
ClosedPublic

Authored by aklapper on Apr 1 2024, 10:32.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 20:11
Unknown Object (File)
Fri, Apr 26, 20:11
Unknown Object (File)
Fri, Apr 26, 20:11
Unknown Object (File)
Fri, Apr 26, 20:10
Unknown Object (File)
Thu, Apr 25, 23:01
Unknown Object (File)
Thu, Apr 25, 12:46
Unknown Object (File)
Thu, Apr 25, 12:46
Unknown Object (File)
Fri, Apr 19, 00:42

Details

Summary
  • Properly handle when no mail headers at all can be parsed
  • Properly handle when mail headers can be parsed but no subject line can be found
EXCEPTION: (RuntimeException) Undefined index: subject

Closes T15769

Test Plan

See T15769

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.Apr 1 2024, 10:32
externals/mimemailparser/MimeMailParser.class.php
314

This is becoming a bit hacky now, since false is probably never returned anymore.

Maybe moving this exception to the consumer? I mean throwing in line 57 of mail_handler.php

externals/mimemailparser/MimeMailParser.class.php
314

In my understanding the return value false was not handled anywhere anyway, so I didn't mind. I was after throwing a correct error message instead of failing way later with a misleading error message. :)

20after4 added inline comments.
externals/mimemailparser/MimeMailParser.class.php
310–314

This is becoming a bit hacky now, since false is probably never returned anymore.

should it be like this then?

Simplify logic (thanks Mukunda!)

sgtm

Go MoreMimeMailParserPeouw

This revision is now accepted and ready to land.Thu, Apr 4, 10:46

FTR I gave this last version another test locally, feeding an mbox file with no subject header (which is accepted now without complaints), and bugging input again (which prints a correct error message instead of misleadingly complaining about a missing subject line)