PHP Classes

File: sample.usage.php

Recommend this page to a friend!
  Classes of Alexander   Email attachments reader (IMAP/POP3)   sample.usage.php   Download  
File: sample.usage.php
Role: Example script
Content type: text/plain
Description: Howto
Class: Email attachments reader (IMAP/POP3)
Retrieve file attachments from e-mail messages
Author: By
Last change:
Date: 14 years ago
Size: 529 bytes
 

Contents

Class file image Download
<?php

   
// This script saves all attachments from all emails into a $save_to folder with original filenames

   
require './class.AReader.php';

   
$save_to = '/tmp';

   
$mbox = new AReader($host, $user, $password);
   
    if (!
$mbox->Connect()) {
        die(
'Unable to establish connection with mailbox');
    }
   
    while (
$mbox->FetchMail()) {
        if (
$mbox->HasAttachment()) {
            while(
$mbox->FetchAttachment()) {
               
$data = $mbox->SaveAttachment($save_to);
            }
        }
       
       
//$mbox->DeleteMail();
   
}
   
   
$mbox->Close();

?>