Dave Fischetti wrote: > On Jul 10, 2008, at 4:30 AM, Alexandru Stanoi wrote: > >> Dave Fischetti wrote: >>> Hi all, the other day I received this error for the first time in >>> about a year (I hadn't made any changes to anything). I'm using >>> ezcomponents-2007.2.1 >>> Fatal error: Argument 2 passed to ezcMail::walkParts() must not be >>> null, called in /usr/include/php/ezcomponents-2007.2.1/Mail/src/ >>> mail.php on line 438 and defined in /usr/include/php/ >>> ezcomponents-2007.2.1/Mail/src/mail.php on line 430 >>> here is the email that I believe caused it, but I'm not sure. >>> There was no body to the email. The user just sent a subject. I've >>> had that before without error so i don't think that caused it: >>> Received: (qmail 27779 invoked from network); 5 Jul 2008 17:02:35 >>> -0400 >>> Received: from mailgate1.domain.com (HELO domain.com) (xx.xxx.xx.xxx) >>> by mydomain.com with (DHE-RSA-AES256-SHA encrypted) SMTP; 5 Jul >>> 2008 17:02:35 -0400 >>> Received-SPF: pass (mydomain.com: local policy designates >>> xx.xxx.xx.xxx as permitted sender) >>> Received: from ([12.165.36.249]) >>> by mailgate1.domain.com with ESMTP id KP-BPZGN.208254597; >>> Sat, 05 Jul 2008 17:02:15 -0400 >>> Subject: Yes >>> From: [EMAIL PROTECTED] >>> Date: Sat, 5 Jul 2008 17:02:19 -0400 >>> To: [EMAIL PROTECTED] >>> Importance: Normal >>> Message-ID: <[EMAIL PROTECTED]> >>> X-MIMETrack: Serialize by Router on ETCSPLNG103/MAIL/CCE(Release >>> 7.0.3| September 26, 2007) at >>> 07/05/2008 05:02:22 PM >>> MIME-Version: 1.0 >>> I'd appreciate any help trying to see what caused this. >> Hi Dave, >> >> The error is most likely caused by an empty body in the mail. Mail >> bodies are optional according to RFC2822, so it looks like a bug. I >> opened an issue for it (http://issues.ez.no/13329) and a fix is >> already in SVN. >> >> If you cannot upgrade your eZ Components version (I see you still >> use 2007.2.1) you can add the fix yourself in mail.php: >> >> mail.php, line 433: >> <code> >> case 'ezcMail': >> case 'ezcMailComposer': >> $this->walkParts( $context, $mail->body ); >> break; >> </code> >> >> will become: >> <code> >> case 'ezcMail': >> case 'ezcMailComposer': >> if ( $mail->body !== null ) >> { >> $this->walkParts( $context, $mail->body ); >> } >> break; >> </code> >> >> Hope this helps. >> >> Cheers, >> Alex. >> >> -- >> Alexandru Stanoi >> eZ Components System Developer >> eZ Systems | http://ez.no > > Thank you for the quick reply and prompt resolution! Much appreciated. > I'm thinking that if the body is null I could also make the body = > subject. since I ignore the subject when parsing. The subject in this > case is the data I need. > > So could I possibly do this? Or do I need to define the type of PART > I'm defining? > > <code> > case 'ezcMail': > case 'ezcMailComposer': > if ( $mail->body !== null ) > { > $this->walkParts( $context, $mail->body ); > } > else > { > $mail->body = $mail->subject; > } > > > break; > </code>
The body should be a mail part (a class extending ezcMailPart), otherwise you will get the same error as before when calling fetchParts(). If you want to do it like above, the "else" brach should be like this: <code> //... else { $mail->body = new ezcMailText( $mail->subject ); } </code> and you would access the text contained in the body as $mail->body->text where you need it. -- Alexandru Stanoi eZ Components System Developer eZ Systems | http://ez.no -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components