PHP Code for Email Inbox Management

The PHP Code for List, Manage and Delete Emails from an Email Account

Email is a one of the most used communication systems around, over which important business decisions are often made, therefore an adequate email management system is vital to any business. For Developers working on Email Management, this below PHP code will help you to design the Inbox for Emails through which you can List, Manage and Delete the emails in the order you want

<?php

$title = "Inbox";

require_once ("inc/config.php");
require_once ($basedir."lib/inbox.php"); // The code for your inbox
require_once ($basedir."lib/html.php");

$inbox = new Inbox();
$html = new Html();

if ($_REQUEST['ids_to_delete'])
$inbox->deleteEmail($_REQUEST['ids_to_delete']);


include ($basedir."inc/header.php"); // The header code of your website
include ($basedir."inc/navbar.php"); //The navigation code of your website


if (isset($_REQUEST['max_msg_id']))
$inbox->max_msg_id = $_REQUEST['max_msg_id'];

if (isset($_REQUEST['delimiter']))
$inbox->delimeter = $_REQUEST['delimiter'];

//next x and previous x links
$nextPrev = $inbox->getNextPrevious();

//local display function
display_next_previous();


//$inbox->displayEmailOverview();
$contents = $inbox->get_Inbox();

//local display function
display_inbox($contents);

include ($basedir."inc/footer.php");



//local functions
function display_next_previous() {
global $html,$nextPrev,$inbox;
print $html->table_start('id="nextPrevTable"');
print $html->tr( $html->td($html->a('inbox.php?max_msg_id='.$nextPrev->nextX.'
&delimiter='.$inbox->delimiter,'Next '.$inbox->delimiter) ) .
$html->td( $html->a('inbox.php?max_msg_id='.$nextPrev->prevX.'
&delimiter='.$inbox->delimiter,'Previous '.$inbox->delimiter),
'id="right"' )
);
print $html->table_end();
}

function display_inbox($contents) {
global $html,$inbox;
print $html->javascript('confirmEmailDelete.js');
print $html->form_start('method="post"
action="inbox.php" id="inbox" name="inbox" onsubmit=\'return confirmEmailDelete("inbox","ids_to_delete[]");\'');
print $html->javascript('checkAll.js');
print $html->button("value='Check All'
onclick='checkAll(\"inbox\",\"ids_to_delete[]\")'");
print $html->table_start('id="inboxTable"');

$i=0;

foreach ($contents as $mail) {

$params = ($i%2) ? '' : 'class=\'oddrow\'';

$att_display = ($mail->attachments) ? "<div id='attachment'>A</div>" : "";

print $html->tr(
$html->td($html->checkbox("ids_to_delete[]", $mail->msgno)) .
$html->td($mail->msgno) .
$html->td($att_display) .
$html->td($html->a("view.php?msgno=$mail->msgno",
$mail->subject, "id='emailLink'") ) .
$html->td($mail->from) .
$html->td($mail->date)

, $params
);

$i++;
}

print $html->table_end();
print $html->submit("Delete Checked");
print $html->form_end();
}
?>


Related Topic What are all Common use of SSH for UNIX and Linux systems
What is the Difference between i386 and x86-64
What are all the Components of Android Application Architecture
Basic Linux Commands
Validate Email Address

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback