#1
  1. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Sorry, I've found a function that I need to understand how to use, and how to get the data, the documentation seems a little lack on information about the objects..

    In short, I obviously need to analyze an incoming message, and flag, or link to attachments, instead displaying the encoded data.

    I've not had any problems until this one..


    anyone have an example? working code, that I could look over? anything at this point?

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  2. #2
  3. No Profile Picture
    a total freak
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    33
    Rep Power
    14
    ive got an example for you to view on:

    <html>
    <head>
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
    <title>PHPwebmail</title></head>

    <body bgcolor="#000088" text="white" link="white" alink="white" vlink="white">
    <font face="arial" size=2>

    <b><a href="http://www.bmpsystems.com" target="_blank">bmp System Support</a>'s<
    /b>
    <font size=+2>&nbsp;&nbsp;PHPwebmail 1.0<font size=2><BR>
    <br>
    <br>

    <?php

    function delete_mail () {

    global $server;
    global $name;
    global $passwd;
    global $message

    $mbox = imap_open("{".$server.":143}INBOX",$name,$passwd);
    $head = imap_headerinfo($mbox,$message,40,40,"");
    $deleted = $head->Deleted;

    // just toggle the messages "Deleted" flag. The message will be removed with expunge_mails.
    if ($deleted == "D") imap_clearflag_full($mbox,imap_uid($mbox,$message),
    'DELETED',SE_UID);
    else imap_setflag_full($mbox,imap_uid($mbox,$message),'DELETED',SE_UID
    );

    $dummy = imap_close($mbox);
    }


    function expunge_mails () {

    global $server;
    global $name;
    global $passwd;

    $mbox = imap_open("{".$server.":143}INBOX",$name,$passwd);
    $dummy = imap_expunge($mbox);
    $dummy = imap_close($mbox);
    }


    function show_mailbox () {

    // remember the passed login information
    global $server;
    global $name;
    global $passwd;

    // open an IMAP connection
    $mbox = imap_open("{".$server.":143}INBOX",$name,$passwd);

    if ($mbox == 0) { echo ("<B>ERROR - could not login&nbsp;&nbsp; <A HREF="in
    dex.html">try again</A></B>");
    } else {
    echo ("<B>".$name."'s inbox&nbsp;&nbsp; <A HREF="index.html">Logout / Lo
    gin</A></B><BR><BR>");
    $messages = imap_num_msg($mbox);

    if ($messages == 0) {
    echo ("<B>You don't have any messages.</B><BR>");
    echo ("<font face="arial" size=2><FORM ACTION="send_mail.php3" MET
    HOD=POST><INPUT TYPE=HIDDEN NAME=server VALUE=".$server."><INPUT TYPE=HIDDEN NAM
    E=name VALUE=".$name."><INPUT TYPE=HIDDEN NAME=passwd VALUE=".$passwd."><B><INPU
    T TYPE=SUBMIT VALUE="send message"></B></FORM>");
    }
    else {
    echo ("<TABLE BORDER=1><TR VALIGN=TOP><TD BGCOLOR="WHITE"><font face
    ="arial" color=black size=2><B>Date/Time<BR>From</B></TD><TD BGCOLOR="WHITE"
    ><font face="arial" color=black size=2><B>Subject<BR>(Status)</B></TD><TD BGCO
    LOR="WHITE" ALIGN=CENTER><font face="arial" color=black size=2><B>Action</B>
    </TD></TR>");

    // display the messages in a table
    for ($i=1;$i<=$messages;$i++) {
    $head = imap_header($mbox,$i,255,80,"");
    $date = $head->date;
    $from = htmlspecialchars($head->fromaddress);
    // be special chars safe
    $subject = decode_mime_string($head->subject);
    $recent = $head->Recent;
    $new = $head->New;
    $unseen = $head->Unseen;
    $flagged = $head->Flagged;
    $answered = $head->Answered;
    $deleted = $head->Deleted;

    // check for attachments
    $structure = imap_fetchstructure($mbox, $i);
    $attach = sizeof ($structure->parts)-1;

    echo ("<TR VALIGN=TOP ><TD BGCOLOR="WHITE"><font face="arial
    " color=black size=2>".$date."<BR><BR>".$from."</TD><TD BGCOLOR="WHITE"><fontface="arial" color=black size=2>".$subject."<BR><BR><I>".$recent.$new.$unseen.
    $flagged.$answered.$deleted."</I>");
    if ($attach == 1) echo ("<BR>1 attachment</TD>");
    if ($attach > 1) echo ("<BR>".$attach." attachments</TD>");
    echo ("</TD>");

    // Note here that we pass the user information as hidden valuesso
    // they don't show up in the location bar of the browser.
    // Looking at the source of this propably cached webpage however
    will
    // show the name and password in clear text!
    echo ("<TD BGCOLOR="WHITE" ALIGN=CENTER><FORM ACTION="read_ma
    il.php3" METHOD=POST><INPUT TYPE=HIDDEN NAME=server VALUE=".$server."><INPUT TY
    PE=HIDDEN NAME=name VALUE=".$name."><INPUT TYPE=HIDDEN NAME=passwd VALUE=".$pass
    wd."><INPUT TYPE=HIDDEN NAME=message VALUE=".$i."><INPUT TYPE=HIDDEN NAME=attach
    VALUE=".$attach."><INPUT TYPE=IMAGE SRC="images/read.gif" BORDER=0></FORM>");
    echo ("<FORM ACTION="send_reply.php3" METHOD=POST><INPUT TYPE=
    HIDDEN NAME=server VALUE=".$server."><INPUT TYPE=HIDDEN NAME=name VALUE=".$name.
    "><INPUT TYPE=HIDDEN NAME=passwd VALUE=".$passwd."><INPUT TYPE=HIDDEN NAME=messa
    echo ("Click <B>"(un)delete"</B> to mark/unmark a message for deletion. <BR>To finally delete marked messages click <B>"expunge"</B>.");
    }
    // close the stream
    $dummy = imap_close($mbox);
    }
    }


    // this is the main entry point

    // use mime decoding-encoding functions
    require("mime.php3");

    if ($action == "delete") delete_mail();
    if ($action == "expunge") expunge_mails();

    show_mailbox();

    ?>
    </BODY></HTML>
  4. #3
  5. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Thanks a bunch for the response.

    Will need a little time to look it all over.


    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

Similar Threads

  1. out put of < > and &lt; &gtl
    By don_sparko in forum ColdFusion Development
    Replies: 2
    Last Post: November 25th, 2003, 04:26 PM
  2. Replies: 2
    Last Post: February 21st, 2003, 01:14 PM
  3. <? echo $id?>
    By abcd in forum PHP Development
    Replies: 10
    Last Post: April 16th, 2002, 02:42 AM
  4. grep from < pre> until < /pre>
    By yhcmarc in forum Perl Programming
    Replies: 4
    Last Post: February 18th, 2002, 05:35 PM
  5. Replies: 7
    Last Post: August 22nd, 2001, 12:40 PM

IMN logo majestic logo threadwatch logo seochat tools logo