Rt-mailgate error with 4.4.4

I’ve been running down a procmail/rt-mailgate issue and wanted to share what I’ve found.
I’ve been getting this error:
Can’t call method “as_string” on an undefined value at /data/rt/sbin/…/lib/RT/EmailParser.pm line 326.


This error started when we upgraded from 4.2.16 to 4.4.4. Has anyone else seen it?

Additionally, our messages get into RT by sendmail -> procmail -> RT. I didn’t realize it but procmail was happily moving to the next rule when rt-mailgate failed, which had the unfortunate side effect of deleting emails that rt-mailgate couldn’t process. Here is how I’ve changed our procmail stanzas to prevent this problem in the future.


    | {{rt_dir}}/bin/rt-mailgate --queue $QUEUE --action $ACTION --url "https://{{rt_webdomain}}/"


    | {{rt_dir}}/bin/rt-mailgate --queue $QUEUE --action $ACTION --url "https://{{rt_webdomain}}/"

(The HOST part makes procmail stop processing rules no matter what has happened.)

I don’t know what’s happening, but FYI it looks like I can probably work around this by disabling TreatAttachedEmailAsFiles.

FYI I have not set up a complete test case, but my current hypothesis is that $TreatAttachedEmailAsFiles cannot parse an email that has an attachment of type email on it. I don’t know why that is; I’ve just disabled the option instead.