Login   Register  
PHP Classes
elePHPant
Icontem

File: mail_decoder_example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Paul Scott  >  MIME Mail Decoder  >  mail_decoder_example.php  >  Download  
File: mail_decoder_example.php
Role: Example script
Content type: text/plain
Description: Example Script
Class: MIME Mail Decoder
Retrieve and decode messages from a POP3 account
Author: By
Last change: Added more documentation and better explanations to the example file, in order to make using this class as easy as possible.
Date: 2006-01-10 21:17
Size: 1,416 bytes
 

Contents

Class file image Download
<?php
     
//first include the class
        
include('mail_decoder_class_inc.php');

        
//fill out your username, password and mail server, 
        //as well as giving the class a directory to work in. 
        //This is where file attachments will be saved! 
        //PS Make sure it is writeable!
     
$mail = new mail('mail.example.com''password''username''/var/www/mymailapp/mail/');

     
//lets connect to the mailserver now. 
        //NOTE: This setup will leave the messages on the server
        //If you would like to delete the messages once you have
        //downloaded them, set the $delete arg to true
        //Example: $messages = $mail->connectMail(TRUE);
        
$messages $mail->connectMail();

    
// debug     
    
print_r($messages);

     
//Now its time to decode the messages!
    
$decodedmail $mail->decodeMessages($messages);

     
//insert the decoded mail to a db or a web page/whatever
    //The class will return an associative array of the messages, 
        //as well as a reference to the file that it wrote from any
        //attachments. It gives the file a funky filename, 
        //so that if you receive duplicate filenames, both files will 
        //be preserved. Remember to rename your files before sending 
        //them off again! This is done simply by replacing the bit after
        //the "_<timestamp>".

     //debug     
    
print_r($decodedmail);
?>