<?
########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

include_once("auth.php");
include("email_functions.php");
include("email_config.php");

/* POP3-Connect: */
e_connect();
if($msgDelMail) {
  $ids[] = $msgDelMail;
}
$numMsgToDel = sizeof($ids);
if($numMsgToDel == "") {
  $delinfo = $lang_text["wbm_delete_nomsg"];
} elseif($numMsgToDel == 1) {
  $delMsg = $ids[0];
  imap_delete($mbox, $delMsg);
  $delinfo = str_replace("%numMessages%",$ids[0],$lang_text["wbm_delete_msg1"]);
} else {
  sort($ids);
  for($i=0; $i < $numMsgToDel; $i++) {
    $delMsg = $ids[$i];
    imap_delete($mbox, $delMsg);
    $delMsgList = $delMsgList.$ids[$i];
    if($i < ($numMsgToDel-1)) {
      $delMsgList = $delMsgList.", ";
    }
  }
  $delinfo = str_replace("%numMessages%",$delMsgList,$lang_text["wbm_delete_msg2"]);
}


/* POP3-Disconnect: */
imap_expunge ($mbox);
imap_close($mbox);

header( "Location: ./email_postfach.php" );
?>
