#1
  1. No Profile Picture
    HappyFunball
    Guest
    Devshed Newbie (0 - 499 posts)
    Hello,

    I am writing a small PHP application for my corporate Intranet. This program will query a user for username and password for thier mailserver. The program will then scan the mailserver for IMAP folders, and display them with various info. The default folder is INBOX.

    However, I'm running into a problem.

    When I specifically set the mailbox to open, PHP opens it and displays the contents, all fine and dandy. But when I do the following:

    $mbox = imap_open("{$MyServer}$PBOX", $username, $passwd, OP_READONLY);

    it fails. I should say, when I set $PBOX = "INBOX" earlier in the script, it opens without a hitch, but if I do:

    <a href="poll_imap.phtml?$PBOX=INBOX">Click Me for INBOX</a>

    the script fails to open the mailbox. The resulting error code being:

    Couldn't open stream {daopmp02.corp.sprint.com:143}INBOX

    I look at this and say to myself "But that SHOULD open the mailbox!"...
    At first I thought the script might not be re-passing the username and password information, but I'm using a session-only cookie to store that info.

    this has been driving me mad for a week now. I've tried dozens of permutations of the code, and nothing seems to be working. If someone out there can take a look at this and try it out themselves, help me come up with a solution I'd greatly appreciate it.
  2. #2
  3. No Profile Picture
    horaR
    Guest
    Devshed Newbie (0 - 499 posts)
    Hello,
    I am starting up a basic mail reader in my corporate intranet too.
    I do the same imap_open (without the OP_READONLY) and it works fine.
    I have, as an example:
    $MyServer = "192.168.4.11"; (in a config file)
    $PBOX = "INBOX"; (from the URL)
    and
    $mbox = imap_open("{$MyServer}$PBOX", $username, $passwd);

    I see a little thing about your link that maybe it is the problem. The dollar sign.
    I believe that the link shoul be:
    <a href="poll_imap.phtml?PBOX=INBOX">Click Me for INBOX</a>

    I hope that it works,
    best regards, horacio
  4. #3
  5. No Profile Picture
    HappyFunball
    Guest
    Devshed Newbie (0 - 499 posts)
    that was a typo in my message post.

    I continue to have major problems as i try to figure this out.

    here's what I'm doing, and it's failing miserably:

    The first time a user logs into the program, I have to scan a list of about 15 mailservers to see which one they use. Once I have determined that server, I set a cookie ($MyServer) equal to that servername ({yadda.server.com:143/imap}) <- i've also tried without the /imap part, it works either way....

    Then I check to see if the $PBOX var is set, if not, i set the emailserver var:

    // determine which IMAP mailbox to open
    if(isset($PBOX)){ // if user specifies a mailbox to open, append to server string
    $MyServer .= $PBOX;
    } else { // if not, append default INBOX to server string
    $MyServer .= "INBOX";
    }

    // let's try opening the mailbox.
    $mbox = imap_open($MyServer, $username, $passwd, OP_READONLY);


    when I don't set $PBOX in the url, it scans the correct folder (INBOX) and returns the message count.

    when I set the else statement to:
    $MyServer .= "TEST"
    it successfully scans the test (or whatever other folder i specify) and also returns the correct message count...

    But alas, when i do this in my IE location bar: http://..../poll_imap.phtml?PBOX=TEST (or INBOX, or whatever), it still fails fails fails...

    or the same thing from an <a href="poll_imap?PBOX=TEST (or INBOX or whatever), it also fails fails fails.

    I'd really appreciate any insight anyone can offer. Whereas I can surely limit my program to ONE measly folder (inbox) capability, I'd rather offer my users more functionality. Eventually creation/deletion of folders.

    Ultimate goal here: Get corporate standards away from MS Outlook (which EVERYONE hates) and on to this PHP based web-mail app... a noble cause if you ask me

    and now that's just too cute.


    [This message has been edited by HappyFunball (edited 09-22-99).]

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 11:45 PM
  2. How to see the Memory used by a PHP script?
    By Pardall in forum PHP Development
    Replies: 4
    Last Post: February 13th, 2004, 04:54 PM
  3. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 02:14 PM
  4. Passing string from PHP to Javascript
    By ka8oad in forum JavaScript Development
    Replies: 4
    Last Post: January 17th, 2004, 04:12 PM
  5. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 02:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo