PHP Classes

save file as filename

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  save file as filename  >  (Un) Subscribe thread alerts  
Subject:save file as filename
Summary:using the sample file
Messages:12
Author:rgb
Date:2013-02-06 17:56:05
Update:2013-02-14 20:53:29
 
  1 - 10   11 - 12  

  1. save file as filename   Reply   Report abuse  
Picture of rgb rgb - 2013-02-06 17:56:05
test_message_decoder.php

$message_file=((IsSet($_SERVER['argv']) && count($_SERVER['argv'])>1) ? $_SERVER['argv'][1] : 'test/sample/message.eml');


'DataFile' => string 'C:/wamp/www/mimeparser-2012-08-23/attachments/\52' (length=49)
'FileName' => string 'attachment.txt' (length=14)


is there a way to save file as 'FileName' ('attachment.txt') not '52'

  2. Re: save file as filename   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-02-07 03:35:01 - In reply to message 1 from rgb
Set the use_part_file_names to true.

  3. Re: save file as filename   Reply   Report abuse  
Picture of rgb rgb - 2013-02-07 14:57:08 - In reply to message 2 from Manuel Lemos
thanks. now I can see the filename

but if I have many .eml files that have 'logo.gif' attachment
I will not know how to link .eml file and attachment

I know $message_file

$message_file=((IsSet($_SERVER['argv']) && count($_SERVER['argv'])>1) ? $_SERVER['argv'][1] : 'test/sample/message.eml');


maybe append $message_file to 'attachment name'

456.eml.logo.gif


  4. Re: save file as filename   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-02-08 05:06:38 - In reply to message 3 from rgb
If you have many messages to process, just use a different directory to save its parts changing the SaveBody parameter.

  5. Re: save file as filename   Reply   Report abuse  
Picture of rgb rgb - 2013-02-08 08:37:15 - In reply to message 4 from Manuel Lemos


/test/sample/message.eml:
1
2
attachment.txt
background.gif
logo.gif


/test/sample/longheader:

/test/sample/mbox:
1

/test/sample/missingheaderseparator:
1

/test/sample/mixedlinebreaks:
1
1.gig
2.gif
3.gif
4.gif
5.gif

/test/sample/noendbreak:
1
2
attachment.txt
background.gif
logo.gif

/test/sample/g-encoding:
1




some folders create files
1
2

no file extension

  6. Re: save file as filename   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-02-08 10:42:13 - In reply to message 5 from rgb
What is that?

  7. Re: save file as filename   Reply   Report abuse  
Picture of rgb rgb - 2013-02-09 01:52:03 - In reply to message 6 from Manuel Lemos
>>just use a different directory to save its parts changing the SaveBody parameter.


I am doing a filelist array

creating a folder named file in filelist
and saving attachments in that folder

I am using your sample files found in mimeparser-2012-08-23/test/sample

and for some files there are no attachments
some files have
1

some files have
1
2

  8. Re: save file as filename   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-02-09 03:16:19 - In reply to message 7 from rgb
That is because those parts do not have associated file names. Those parts are usually text or HTML.

  9. Re: save file as filename   Reply   Report abuse  
Picture of rgb rgb - 2013-02-14 09:06:09 - In reply to message 8 from Manuel Lemos
I have created folders for ALL email attachments that save attachments

if (strpos($decoded[$message]['Headers']['to:'],"@email.com") || strpos($decoded[$message]['Headers']['from:'],"@email.com")) {

this will echo only the emails I want

but I only want to create folders and save email attachments for the emails I want to save

  10. Re: save file as filename   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-02-14 09:58:54 - In reply to message 9 from rgb
The MIME parser class only parses one message at a time. It is up to you to set the SaveBody parameter only for the messages you want to save.

 
  1 - 10   11 - 12