Re: Save email as .eml file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

Well it can be easily done. Just input your mail (make 'procmail' fwd
it) to your script & script would save it as .eml .

Try to use the following code for script :

######## CODE #####################

<?php 

$email = "";
## Read
E-mail                                                                                                 
$fd = fopen("php://stdin", "r");
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);

# Save email
$handle = fopen("$path/$file_name.eml","a+");
 if (!$handle) {
   fwrite($log_handle," Failed ");
 }
 else {
   fwrite($handle,"$email");
   fclose($handle);
 }


?>

Hope this helps you out.


Greetings
Utsav Handa

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux