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.
Stack:
[/data/rt/sbin/../lib/RT/EmailParser.pm:326]
[/data/rt/sbin/../lib/RT/EmailParser.pm:342]
[/data/rt/sbin/../lib/RT/EmailParser.pm:274]
[/data/rt/sbin/../lib/RT/Interface/Email.pm:190]
[/data/rt/share/html/REST/1.0/NoAuth/mail-gateway:61]
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.
was:
:0wc
| {{rt_dir}}/bin/rt-mailgate --queue $QUEUE --action $ACTION --url "https://{{rt_webdomain}}/"
now:
:0w
{
:0wc
| {{rt_dir}}/bin/rt-mailgate --queue $QUEUE --action $ACTION --url "https://{{rt_webdomain}}/"
:0
{
EXITCODE=$? HOST=
}
}
(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.