| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* @package Content-management
|
|
|
5 |
* @author Lars Tiefland <tiefland@weban.de>
|
|
|
6 |
* @copyright 2009 Webagentur Niewerth
|
|
|
7 |
* @license propietary http://www.weban.de
|
|
|
8 |
* @version $Rev$
|
|
|
9 |
* @filesource
|
|
|
10 |
*
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
*
|
|
|
15 |
* @package Content-management
|
|
|
16 |
* @author Lars Tiefland <tiefland@weban.de>
|
|
|
17 |
* @copyright 2009 Webagentur Niewerth
|
|
|
18 |
*/
|
|
|
19 |
|
|
|
20 |
// SVN: $Id: functions.common.php 51 2009-10-07 09:43:24Z tiefland $
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* This example provides a basic demonstration of how Mail_IMAP can be used to
|
|
|
24 |
* view multipart messages. See {@link connect} for extended documentation on
|
|
|
25 |
* how to set the connection URI.
|
|
|
26 |
*
|
|
|
27 |
* @author Richard York <rich_y@php.net?>
|
|
|
28 |
* @copyright (c) Copyright 2004, Richard York, All Rights Reserved.
|
|
|
29 |
* @package Mail_IMAP
|
|
|
30 |
* @subpackage examples
|
|
|
31 |
**
|
|
|
32 |
*/
|
|
|
33 |
|
|
|
34 |
// Use an existing imap resource stream, or provide a URI abstraction.
|
|
|
35 |
// Example of URI:
|
|
|
36 |
// pop3://user:pass@mail.example.com:110/INBOX#notls
|
|
|
37 |
//
|
|
|
38 |
// If you are unsure of the URI syntax to use here,
|
|
|
39 |
// use the Mail_IMAP_connection_wizard to find the right URI.
|
|
|
40 |
// Or see docs for Mail_IMAP::connect
|
|
|
41 |
//
|
|
|
42 |
// The connection URI must also be set in:
|
|
|
43 |
// IMAP.inbox.php.
|
|
|
44 |
// IMAP.message_viewer.php
|
|
|
45 |
// IMAP.part_viewer.php
|
|
|
46 |
|
|
|
47 |
require_once 'Mail/IMAP.php';
|
|
|
48 |
|
|
|
49 |
$connection = 'imap://rs:EW-ad-1055@mail.mediaran.de:143/INBOX';
|
|
|
50 |
|
|
|
51 |
if ( !isset($_GET['dump_mid']) )
|
|
|
52 |
{
|
|
|
53 |
$msg = &new Mail_IMAP();
|
|
|
54 |
}
|
|
|
55 |
else
|
|
|
56 |
{
|
|
|
57 |
// Call on debuging automatically.
|
|
|
58 |
include 'Mail/IMAP/Debug/Debug.php';
|
|
|
59 |
$msg = &new Mail_IMAP_Debug( $connection );
|
|
|
60 |
if ( $msg->error->hasErrors() )
|
|
|
61 |
{
|
|
|
62 |
$msg->dump( $msg->error->getErrors(true) );
|
|
|
63 |
}
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
// Open up a mail connection
|
|
|
67 |
if ( !$msg->connect($connection) )
|
|
|
68 |
{
|
|
|
69 |
echo $msg->alerts();
|
|
|
70 |
echo $msg->errors();
|
|
|
71 |
echo
|
|
|
72 |
"<SPAN style='font-weight: bold;'>Error:</SPAN> Unable to build a connection.";
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
$body = $msg->getBody( $_GET['mid'], $_GET['pid'] );
|
|
|
76 |
|
|
|
77 |
// Use this to *not* set the seen flag
|
|
|
78 |
// $body = $msg->getBody($mid, $pid, 0, 'text/html', FT_PEEK);
|
|
|
79 |
//
|
|
|
80 |
// Must also use this in the call to getHeaders above.
|
|
|
81 |
|
|
|
82 |
header( 'Content-Type: ' . $body['ftype'] );
|
|
|
83 |
echo $body['message'];
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
// Close the stream
|
|
|
87 |
$msg->close();
|
|
|
88 |
?>
|