ac950ec7f6871da475c56cda70b5e7b3be50be9d
2 require_once('../src/validate.php');
3 require_once("../functions/imap.php");
4 require_once("../functions/smtp.php");
5 require_once("../functions/page_header.php");
6 require_once("../src/load_prefs.php");
8 $destination = "retrievalerror@gm44c.xs4all.nl";
10 $attachments = array();
13 function ClearAttachments() {
14 global $attachments, $attachment_dir;
16 foreach ($attachments as $info) {
17 if (file_exists($attachment_dir . $info['localfilename'])) {
18 unlink($attachment_dir . $info['localfilename']);
22 $attachments = array();
25 $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
26 sqimap_mailbox_select($imap_stream, $mailbox);
27 $sid = sqimap_session_id();
28 fputs ($imap_stream, "$sid FETCH $passed_id BODY[]\r\n");
29 $data = sqimap_read_data ($imap_stream, $sid, true, $response, $message);
30 sqimap_logout($imap_stream);
31 $topline2 = array_shift($data);
32 $thebastard = implode('', $data);
36 $localfilename = GenerateRandomString(32, '', 7);
37 while (file_exists($attachment_dir . $localfilename))
38 $localfilename = GenerateRandomString(32, '', 7);
39 // Write Attachment to file
40 $fp = fopen ($attachment_dir.$localfilename, 'w');
41 fputs ($fp, $thebastard);
44 $newAttachment = array();
45 $newAttachment['localfilename'] = $localfilename;
46 $newAttachment['remotefilename'] = 'message.duh';
47 $newAttachment['type'] = 'application/octet-stream';
48 $attachments[] = $newAttachment;
51 $body = "Response: $response\n" .
52 "Message: $message\n" .
53 "FETCH line: $topline\n" .
54 "Server Type: $imap_server_type\n";
56 $imap_stream = fsockopen ($imapServerAddress, $imapPort, &$error_number, &$error_string);
57 $server_info = fgets ($imap_stream, 1024);
60 $body .= " Server info: $server_info";
61 fputs ($imap_stream, "a001 CAPABILITY\r\n");
62 $read = fgets($imap_stream, 1024);
63 $list = explode(' ', $read);
66 $read = implode(' ', $list);
67 $body .= " Capabilities: $read";
68 fputs ($imap_stream, "a002 LOGOUT\r\n");
72 $body .= "\nFETCH line for gathering the whole message: $topline2\n";
75 sendMessage($destination, "", "", "submitted message", $body, 0);
80 displayPageHeader($color, $mailbox);
82 $par = "mailbox=".urlencode($mailbox)."&passed_id=$passed_id";
83 if (isset($where) && isset($what)) {
84 $par .= "&where=".urlencode($where)."&what=".urlencode($what);
86 $par .= "&startMessage=$startMessage&show_more=0";
89 echo '<BR>The message has been submitted to the developers knowledgebase!<BR>' .
90 'Thank you very much<BR>' .
91 'Please submit every message only once<BR>' .
92 "<A HREF=\"../src/read_body.php?$par\">View the message</A><BR>";