Specifications

case ‘view-message’ :
{
// if we have just picked a message from the list, or were looking at
// a message and chose to hide or view headers, load a message
$fullheaders = ($action==’show-headers’);
display_message($auth_user, $selected_account, $messageid,
$fullheaders)
;
break;
}
case ‘reply-all’ :
{
//set cc as old cc line
if(!$imap)
$imap = open_mailbox($auth_user, $selected_account);
if($imap)
{
$header = imap_header($imap, $messageid);
if($header->reply_toaddress)
$to = $header->reply_toaddress;
else
$to = $header->fromaddress;
$cc = $header->ccaddress;
$subject = ‘Re: ‘.$header->subject;
$body = add_quoting(stripslashes(imap_body($imap, $messageid)));
imap_close($imap);
display_new_message_form($auth_user, $to, $cc, $subject, $body);
}
break;
}
case ‘reply’ :
{
//set to address as reply-to or from of the current message
if(!$imap)
$imap = open_mailbox($auth_user, $selected_account);
if($imap)
{
$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);
Building a Web-Based Email Service
C
HAPTER 27
27
BUILDING A
WEB-BASED
EMAIL
SERVICE
627
LISTING 27.2 Continued
33 7842 CH27 3/6/01 3:41 PM Page 627