Details
Description
While running bin/EmailProcessor.php (http://host/civi_root/bin/EmailProcessor.php?name=name&pass=pass&key=key&emailtoactivity=1) on an email with an attachment of content-type message/rfc822, you get the above error (in the web server log). It's not clear why since the function formatAddress() exists in that file.
Possibly related is this warning which you get first:
PHP Notice: Undefined variable: key in <civi_root>/sites/all/modules/civicrm/CRM/Utils/Mail/Incoming.php on line 132
This is straightforward though - it's obviously copied-and-pasted code and the reference to $key was left in there.
To reproduce, run the EmailProcessor on the attached file (can use a LocalDir setup for CiviMail). A real email would have more headers but for clarity I trimmed it down, and according to both Lotus Notes and Hotmail is valid (or at least correctly parseable) as is.
Changing the line Content-type: message/rfc822 to something else allows the processor to complete successfully, although it doesn't process the full contents.
Note also it prevents the entire queue from being processed, i.e. it doesn't just skip this email and go on to the next, so you get a backlog.