7
Authors: gael@sednacom.fr
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2 of the License, or
12
(at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . "/");
28
set_include_path(BASE_PATH."server/" . PATH_SEPARATOR . BASE_PATH."server/PEAR/" . PATH_SEPARATOR .BASE_PATH. PATH_SEPARATOR ."/usr/share/php/");
30
require("config.php");
31
require("mapi/mapi.util.php");
32
require("mapi/mapiguid.php");
33
require("mapi/mapidefs.php");
34
require("mapi/mapitags.php");
35
require("server/util.php");
36
require("server/core/class.conversion.php");
37
require("server/core/class.mapisession.php");
38
require("server/core/class.settings.php");
39
require("server/core/class.xmlparser.php");
40
require("server/core/class.bus.php");
41
require("server/core/class.xmlbuilder.php");
42
require("server/core/class.operations.php");
43
require("server/modules/class.module.php");
44
require("server/modules/class.listmodule.php");
45
require("server/modules/class.itemmodule.php");
46
require("server/core/class.properties.php");
47
require("server/modules/class.maillistmodule.php");
49
//////////////////////////////////
50
/// get username and password
51
//////////////////////////////////
52
$username = $_POST['user'];
53
$password = $_POST['password'];
54
$server = 'http://localhost:236/zarafa';
57
////////////////////////////////
58
//connect to the zarafa server
59
///////////////////////////////
60
$GLOBALS["mapisession"] = new MAPISession();
61
$sess = $GLOBALS["mapisession"]->logon($username, $password, $server);
62
$session = mapi_logon_zarafa($username, $password, $server);
63
$bus = new Bus(); // Create global bus object
64
$GLOBALS["bus"] = $bus; // Make bus global
65
$GLOBALS["settings"] = new Settings();
66
$storelist = $GLOBALS["mapisession"]->getAllMessageStores();
67
$id = "webmail4"; //define an id
68
$GLOBALS["operations"] = new Operations();
69
$datas = $GLOBALS["operations"]->getHierarchyList(array(PR_IPM_INBOX));
70
$store_idhex = $datas[store][0][attributes][id];
71
$entryidhex = $datas[store][0][defaultfolders][inbox];
72
$entryid = hex2bin($entryidhex);
76
"attributes" => array(
78
"store" => $store_idhex,
79
"entryid" => $entryidhex,
84
"restriction" => array(
86
"data_retrieval" => "normal"));
89
$GLOBALS["properties"] = new Properties();
90
$email_obj = new MailListModule($id, $data);
91
$stores = mapi_getmsgstorestable($session);
92
$storeslist = mapi_table_queryallrows($stores);
94
$store = mapi_openmsgstore($session, $storeslist[0][PR_ENTRYID]);
95
$email_obj->messageList($store, $entryid, $data[0]);
96
$result = $GLOBALS["bus"]->getData();
97
$result = $result[module][0][action][0][item];
100
foreach($result as $email)
102
$res .= "email start\n";
103
$res .= "zid:".$email[entryid][_content]."\n";
104
$res .= "subject:".$email[subject]."\n";
105
$res .= "from:".$email[sender_email_address]."\n";
106
$res .= "to:".$email[display_to]."\n";
107
$res .= "delivery:".$email[message_delivery_time][_content]."\n";
108
$res .= "email end\n";