PHP Classes

$body array problem

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  $body array problem  >  (Un) Subscribe thread alerts  
Subject:$body array problem
Summary:Minor problem with $body array
Messages:2
Author:fred
Date:2005-10-18 18:20:45
Update:2005-10-18 20:45:14
 

  1. $body array problem   Reply   Report abuse  
Picture of fred fred - 2005-10-18 18:20:45
Hi,

I am quite new to php, however i am wondering if anyone can help me out with the $body array...

In the same script that i use to call the pop3.php file, i wish to automatically download an email, attach a file and forward it to a different recipient.

To download the email this script works fine and is able to be displayed with no problems.
For attaching a file and sending to a recipient i have no problems, i am using phpMailer, this works fine.

However I am having a problem merging the incoming mail, with the outgoing mail. The download part works, and the send email with appropriate attachement works. However the issue i am having surrounds getting the data out of the array... here is the details

for($line=0;$line<count($body);$line++)
echo "<PRE>",HtmlSpecialChars($body[$line]),"</PRE>\n";

These 2 lines display the email on a page in the correct format.
I them want to take the body (which is about 15lines long (size varies!)) and insert it into another email...

I currently have this which doesn't work...

$mail->Body = "hello";
for($line=0;$line<count($body);$line++){
$mail->Body .= "".$body[$line]."\n";
}

I have tried using this... which makes the formatting come out incorrectly...

$body1=implode("\n", $body);
$mail->Body = $body1;

Any pointers that anyone has in helping me get the data out of the array called $body would be very much appreciated.

Thanks
Freddy

  2. Re: $body array problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2005-10-18 20:45:14 - In reply to message 1 from fred
To do what you want properly, you need to decode the message in parts and rebuild it to added the attachment to the outgoing message. That task is outside the scope of the POP3 class.