I have also had many people mention something about the quotations around the server name. Here's my script. When I remove the double quotes I get a 500 internal server error...when I leave the double quotes in, I get an unable to open stream message.
Code: Select all
<?php
/***************************************************************************
* index.php
* -------------------
* begin : Saturday, Aug 16, 2003
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: mailbox.php,v 1.0 2003/08/16 13:37:40 slatfats Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
//
// Start output of page
//
$page_title = "Mailbox";
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'mailbox.tpl')
);
//
// Look up mail server settings
//
$sql = "SELECT * FROM phpbb_user_mail WHERE user_id = " . $userdataї'user_id'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Trouble fetching mailserver data', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$mail_server = $rowї'mail_server'];
$server_type = $rowї'server_type'];
$server_login = $rowї'server_login'];
$server_pass = $rowї'server_pass'];
$delete_msgs = $rowї'delete_msgs'];
if ($server_type == '1')
{
$mail_server = '"{' . $mail_server . ':110/pop3}INBOX"';
}
if ($server_type == '2')
{
$mail_server = '"{' . $mail_server . '}"';
}
$inbox = imap_open ($mail_server, "$server_login", "$server_pass");
if ( isset($HTTP_GET_VARSї'inbox']) && !isset($HTTP_GET_VARSї'read']) )
{
$total = imap_num_msg($inbox);
for($i = $total; $i > 0; $i--)
{
// get header and structure
$headers = imap_header($inbox, $i);
$structure = imap_fetchstructure($inbox, $i);
for ($i = 1; $i < count($headers); $i++)
{
$email_msg = ($i-1);
$msg_links = '<a href="' . append_sid("mailbox.$phpEx?read&msg=$i") . '" class="gen">' . $headersї$email_msg] . '</a><br /><br />';
$template->assign_block_vars("inbox", array(
"MESSAGE_LINKS" => $msg_links)
);
}
}
}
if ( isset($HTTP_GET_VARSї'read']) && !isset($HTTP_GET_VARSї'inbox']) )
{
if ( isset($HTTP_GET_VARSї'msg']) )
{
$msg = intval($HTTP_GET_VARSї'msg']);
}
else
{
header ("Location: $PHP_SELF?inbox");
}
$message = imap_header($get_messages);
$from = $message->from;
$to = $message->to;
$date = $message->Date;
$subject = $message->Subject;
$msg_text = imap_body($get_messages, $msg);
$template->assign_block_vars("read_mail", array(
"FROM" => $from,
"TO" => $to,
"DATE" => $date,
"SUBJECT" => $subject,
"MSG_TEXT" => $msg_text
)
);
}
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>