<?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);
?>
|