Login   Register  
PHP Classes
elePHPant
Icontem

How to format body

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      POP3 e-mail client  >  All threads  >  How to format body  >  (Un) Subscribe thread alerts  
Subject:How to format body
Summary:How to save body parts of a message
Messages:2
Author:davide
Date:2013-02-26 19:29:17
Update:2013-02-27 05:46:44
 

  1. How to format body   Reply   Report abuse  
Picture of davide
davide
2013-02-26 19:29:17
Hi Manuel,
First of all, Thank you for this great PHP class.
I used your class for retrieve email from different pop3 address of different users in my site.

When i get all the email messages i use:
------
$parameters=array( 'File'=>$message_file, 'SaveBody'=>'../../'.$this->username.'/tmp_allegati_mail', );
$success=$mime->Decode($parameters, $decoded); $mime->Analyze($decoded[0], $results);
mkdir('../../'.$this->username."/allegati/mail/".$unique_id."/");
for($j=0;$j<count($results["Attachments"]);$j++){
$allegati[$j]["filename"] = $this->correggi($results["Attachments"][$j]["FileName"]);

copy('../../'.$this->username.'/tmp_allegati_mail/'.($j+2),'../../'.$this->username.'/allegati/mail/'.$unique_id.'/'.$allegati[$j]["filename"]);
}
copy('../../'.$this->username.'/tmp_allegati_mail/1','../../'.$this->username.'/allegati/mail/'.$unique_id.'/body.txt');
$this->del_file_in_dir('../../'.$this->username.'/tmp_allegati_mail/');
-------
Everithing works great,
I can now save all the information of an email: Subject, Addressto,Addressfrom...and all the attchaments in different file.

The only problem is: how can i format the "1" file (the body of the email)?
because if i save it as .txt i loose all the styles and if i format it as .html i loose all the break-line, all the indentation...

Thank you sir!

  2. Re: How to format body   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-02-27 05:46:44 - In reply to message 1 from davide
Each message may be text, HTML or something else. You need to figure what it is to display it. Use the Analyze function to help you figure the main message type and the data that you need to use to render it.