Ejemplo n.º 1
0
         }
         $subject = 'Re: ' . $header->subject;
         $body = add_quoting(stripslashes(imap_body($imap, $messageid)));
         imap_close($imap);
         if ($_POST) {
             display_new_message_form($_SESSION['auth_user'], $to, $cc, $subject, $body);
         } else {
             display_new_message_form($_SESSION['auth_user']);
         }
         break;
     }
     break;
 case 'forward':
     //set message as quoted body of current message
     if (!$imap) {
         $imap = open_mailbox($_SESSION['auth_user'], $_SESSION['selected_account']);
     }
     if ($imap) {
         $header = imap_header($imap, $messageid);
         $body = add_quoting(stripslashes(imap_body($imap, $messageid)));
         $subject = 'Fwd: ' . $header->subject;
         imap_close($imap);
         if ($_POST) {
             display_new_message_form($_SESSION['auth_user'], $to, $cc, $subject, $body);
         } else {
             display_new_message_form($_SESSION['auth_user']);
         }
         break;
     }
     break;
 case 'new-message':
function delete_message($auth_user, $accountid, $message_id)
{
    // delete a single message from the server
    $imap = open_mailbox($auth_user, $accountid);
    if ($imap) {
        imap_delete($imap, $message_id);
        imap_expunge($imap);
        imap_close($imap);
        return true;
    }
    return false;
}
function display_list($auth_user, $accountid)
{
    // show the list of messages in this mailbox
    global $table_width;
    if (!$accountid) {
        echo "<p style=\"padding-bottom: 100px\">No mailbox selected.</p>";
    } else {
        $imap = open_mailbox($auth_user, $accountid);
        if ($imap) {
            echo "<table width=\"" . $table_width . "\" cellspacing=\"0\"\n                   cellpadding=\"6\" border=\"0\">";
            $headers = imap_headers($imap);
            // we could reformat this data, or get other details using
            // imap_fetchheaders, but this is not a bad summary so we just echo each
            $messages = sizeof($headers);
            for ($i = 0; $i < $messages; $i++) {
                echo "<tr><td bgcolor=\"";
                if ($i % 2) {
                    echo "#ffffff";
                } else {
                    echo "#ffffcc";
                }
                echo "\"><a href=\"index.php?action=view-message&messageid=" . ($i + 1) . "\">";
                echo $headers[$i];
                echo "</a></td></tr>\n";
            }
            echo "</table>";
        } else {
            $account = get_account_settings($auth_user, $accountid);
            echo "<p style=\"padding-bottom: 100px\">Could not open mail box " . $account['server'] . ".</p>";
        }
    }
}
function display_list($auth_user, $accountid)
{
    // show the list of messages in this mailbox
    global $table_width;
    if (!$accountid) {
        echo 'No mailbox selected<br /><br /><br /><br /><br /><br />.';
    } else {
        $imap = open_mailbox($auth_user, $accountid);
        if ($imap) {
            echo "<table width = {$table_width} cellspacing = 0 \n                   cellpadding = 6  border = 0>";
            $headers = imap_headers($imap);
            // we could reformat this data, or get other details using
            // imap_fetchheaders, but this is not a bad summary so we just echo each
            $messages = sizeof($headers);
            for ($i = 0; $i < $messages; $i++) {
                echo '<tr><td bgcolor = "';
                if ($i % 2) {
                    echo '#ffffff';
                } else {
                    echo '#ffffcc';
                }
                echo '"><a href ="index.php?action=view-message&messageid=' . ($i + 1) . '">';
                echo $headers[$i];
                echo "</a></td></tr>\n";
            }
            echo '</table>';
        } else {
            $account = get_account_settings($auth_user, $accountid);
            echo 'could not open mail box ' . $account['server'] . '.<br /><br /><br /><br />';
        }
    }
}
Ejemplo n.º 5
0
function display_list($auth_user, $accountid)
{
    //    echo "Debug: display_list()<br />";
    global $table_width;
    //debug $accountid -> $accountid[0]
    $counter = 0;
    //    echo "Debug: counter: ".$counter."<br />";
    if (!$accountid) {
        echo "<p style=\"padding-bottom: 100px\">Mailbox is not selected.</p>";
    } else {
        $imap = open_mailbox($auth_user, $accountid);
        if ($imap) {
            echo "<table width=\"" . $table_width . "\" cellspacing=\"0\"\n                cellpadding=\"6\" border=\"0\">";
            $headers = imap_headers($imap);
            $messages = sizeof($headers);
            for ($i = 0; $i < $messages; $i++) {
                echo "<tr><td bgcolor=\"";
                if ($i % 2) {
                    echo '#ffffff';
                } else {
                    echo '#ffffcc';
                }
                echo "\"><a href=\"index.php?action=view-message&messageid=" . ($i + 1) . "\">";
                echo $headers[$i];
                echo "</a></td></tr>\n";
            }
            echo "</table>";
        } else {
            $account = get_account_settings($auth_user, $accountid);
            echo "<p style=\"padding-bottom: 100px\">Can\\'t open mailbox" . $account['server'] . ".</p>";
        }
    }
}
                $header = imap_header($imap, $messageid);
                if ($header->reply_toaddress) {
                    $to = $header->reply_toaddress;
                } else {
                    $to = $header->fromaddress;
                }
                $subject = 'Re: ' . $header->subject;
                $body = add_quoting(stripslashes(imap_body($imap, $messageid)));
                imap_close($imap);
                display_new_message_form($HTTP_SESSION_VARS['auth_user'], $to, $cc, $subject, $body);
            }
            break;
        case 'forward':
            //set message as quoted body of current message
            if (!$imap) {
                $imap = open_mailbox($HTTP_SESSION_VARS['auth_user'], $HTTP_SESSION_VARS['selected_account']);
            }
            if ($imap) {
                $header = imap_header($imap, $messageid);
                $body = add_quoting(stripslashes(imap_body($imap, $messageid)));
                $subject = 'Fwd: ' . $header->subject;
                imap_close($imap);
                display_new_message_form($HTTP_SESSION_VARS['auth_user'], $to, $cc, $subject, $body);
            }
            break;
        case 'new-message':
            display_new_message_form($HTTP_SESSION_VARS['auth_user'], $to, $cc, $subject, $body);
            break;
    }
}
//*****************************************************************************
Ejemplo n.º 7
0
function delete_message($auth_user, $accountid, $messageid)
{
    $imap = open_mailbox($auth_user, $accountid);
    if ($imap) {
        imap_delete($imap, $messageid);
        imap_expunge($imap);
        imap_close($imap);
        return true;
    }
    return false;
}