PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 21st, 1999, 01:09 PM
HappyFunball
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #2  
Old September 21st, 1999, 04:32 PM
horaR
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #3  
Old September 22nd, 1999, 07:34 AM
HappyFunball
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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 URL

URL and URL now that's just too cute.


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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP + IMAP_OPEN() woes

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap