kevinsir / php-mime-mail-parser

Automatically exported from code.google.com/p/php-mime-mail-parser
0 stars 0 forks source link

No attachments #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. parse a e-mail with attachments. Send of Outlook 2007
2.
3.

What is the expected output? What do you see instead?
A array with attachments. A array with the name of de attachment

What version of the product are you using? On what operating system?
r16, with the attachment class. CentOS with mailparse extension

Please provide any additional information below.

Original issue reported on code.google.com by pimvanro...@gmail.com on 24 Sep 2010 at 1:19

GoogleCodeExporter commented 8 years ago
Here is an example of saving attachments:

{{{

save_dir = '/path/to/save/attachments/';
foreach($attachments as $attachment) {
  // get the attachment name
  $filename = $attachment->filename;
  // write the file to the directory you want to save it in
  if ($fp = fopen($save_dir.$filename, 'w')) {
    while($bytes = $attachment->read()) {
      fwrite($fp, $bytes);
    }
    fclose($fp);
  }
}

}}}

As you'll notice the array should contain MimeMailParser_attachment 
instances/objects. 
You can use the MimeMailParser_attachment::read() method to read the attachment 
data.

Does this solve the problem?

Original comment by buca...@gmail.com on 24 Sep 2010 at 2:09

GoogleCodeExporter commented 8 years ago
Thanks, the array attachements is empty. I'll get the attatchments with 
->getAttachments(); So if the array is full of attachments i'll use your 
example.

Original comment by pimvanro...@gmail.com on 26 Sep 2010 at 4:23

GoogleCodeExporter commented 8 years ago
Does that solve the issue? Or is the issue that the attachments array is empty 
when it should have members?

Original comment by buca...@gmail.com on 26 Sep 2010 at 5:04

GoogleCodeExporter commented 8 years ago
Yes. The array is empty when it should have members. Can suhosin be the problem?

Original comment by pimvanro...@gmail.com on 27 Sep 2010 at 2:32

GoogleCodeExporter commented 8 years ago
Could you attach the mail being parsed please. 

"Can suhosin be the problem?" Have you tested on a PHP executable without 
Suhosin.

Original comment by buca...@gmail.com on 3 Oct 2010 at 7:09

GoogleCodeExporter commented 8 years ago
In the attachment is the e-mail. We don't have a non suhosin environment.

Original comment by pimvanro...@gmail.com on 7 Oct 2010 at 11:44

Attachments:

GoogleCodeExporter commented 8 years ago
We'd need the mime message. Attached is the rendered email text.. ? The same 
file you're parsing that is giving you the problem. 

If  you're actually parsing the attached file, then that is why you are not 
getting attachments. The attachments are encoded in the mime message (the raw 
email message). 

Original comment by buca...@gmail.com on 7 Oct 2010 at 9:52

GoogleCodeExporter commented 8 years ago
In the attachment is the e-mail.

Original comment by pimvanro...@gmail.com on 13 Oct 2010 at 8:23

Attachments:

GoogleCodeExporter commented 8 years ago
Solved, i was sending a array as post field. Thanx for the reply's

Original comment by pimvanro...@gmail.com on 13 Oct 2010 at 12:12

GoogleCodeExporter commented 8 years ago
Glad you got it working. :)

Original comment by buca...@gmail.com on 13 Oct 2010 at 12:58