Location: PHPKode > scripts > PHPwebmail > phpwebmail/move_mail.php
<?php 
/* 
PHPwebmail is a webmail client written in php.

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.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/


   session_start(); 
   require("not_registered.php");
   
   // get user prefs account from DB
      if ($db_link = mysql_connect($sql_host,$sql_user,$sql_pw)) {
	@mysql_select_db("phpwebmail");
	$sql_query = "SELECT textmode FROM prefs WHERE user='$name'";
	$result = mysql_query($sql_query);
        // catch SQL errors
        if (mysql_errno()) echo ("ERROR ".mysql_error());
	$row = mysql_fetch_row($result);
	$textmode = $row[0];
      } // if db_link ends
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
</head>
<body bgcolor="<?php echo $bg_color_frame; ?>" text="<?php echo $fg_color; ?>" link="<?php echo $link_color; ?>" vlink="<?php echo $link_color; ?>" alink="<?php echo $alink_color; ?>">

<?php
$mbox_old = imap_open("{".$imap_server.":143}".$folder,$name,$passwd);
$move_result = imap_mail_move($mbox_old,$message,$folder_new);
if ($move_result) { 
	    echo "<b>Message moved to ";
	    if (!$textmode) echo "<img src=\"images/folder.gif\"> ";
	    echo $folder_new;
	} else echo "<b>ERROR - message was not moved";
$dummy = imap_close($mbox_old);

// use JavaScript to update the message index (moved message is marked for deletion)
?>
<script language="JavaScript">
parent.frames[1].location.href='mail_index.php?<?=SID?>'
</script>

</body>
</html>
Return current item: PHPwebmail