Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Desperate With Help On Php And Imap To Read Emails. Please!
shadow-x
post Mar 31 2008, 04:03 PM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 26
Joined: 4-April 06
Member No.: 12,473



Hi guys and girls. Im an old member who migrated to T17 but im back as it seems no-one at T17 can help. My problem is with PHP and IMAP...

im experimenting with php and IMAP to read emails on my local email server. My local email server is Mercury V4 which apparently does support POP and IMAP, i have confirmed the server is working by sending an email from the server using its internal send mail system and then checking that email using the Thunderbird client. the email was sent and received properly.

So i moved into the PHP area and done the basic connect code (the full code i used is below so check that, im sure its right, i basically copied it) which seemed to work, i got the result: "Resource Id #2" Should that be "#4" instead? One tut said i would get #4 so maybe the error lies here...

Anyway it connected and disconnected with no errors so i proceeded to use Imap_headers($connect); to get the headers of the emails.. Oh no.. It didnt work...The error detection code just told me it had failed with the variable i used to contain the header info returning a FALSE result and as such it just didnt work.... Any ideas? I really cant think of it. My PHPINFO tells me i have IMAP libs installed with the readout being:

QUOTE
IMAP c-Client Version 2004
SSL Support enabled



And as i said the mercury mail server seems to support IMAP and POP so what else can it be? I have just updated to the latest version of PHP and checked that the PHP.INI file contains the right filepath for the IMAP DLL. Im all out of ideas! The code ive used is below and is virtually copied with the changing of a few variable names:


CODE
<?

$user = "phptest";
$pass = "test";

$connect = @imap_open("{localhost}INBOX", $user, $pass)

or die("Connection to server failed");


echo $connect;

$headers = @imap_headers($connect)

or die("Couldn't get emails");




$numEmails = sizeof($headers);

echo "You have $numEmails in your mailbox";


imap_close($connect);


Ive also just updated my email server to the latest version but no luck, ive disabled my firewall with no luck. Im really getting so damn annoyed with this and no-one seems to be able to help..Its just stupid! If you dont know what i can do cna you suggest a FREE, WINDOWS XP, mail server that i can try?

Im desperate here its driving me frikking mad.
Go to the top of the page
 
+Quote Post
Jared
post Apr 19 2008, 07:01 AM
Post #2


Member [ Level 1 ]
Group Icon

Group: [HOSTED]
Posts: 40
Joined: 17-April 08
Member No.: 29,853



I actually copy-and-pasted your code directly into a new file on my home server and replaced the user and pass variables with my own and replaced localhost with my mail server's name and it connected perfectly and correctly reported the number of emails in my inbox...

Also, the echo $connect; also returns Resource id #2 as well, which is interesting. I'm not sure that the id number really matters, it probably depends on how PHP is installed or what version you have... I'm not sure.

But as a result of this, I would have to think that there is a problem with your mail server... Either there's a connection problem--does your server require authentication?--or there's an error in the build, or something. Have you checked the troubleshooting manual? Because I'm led to believe that it's a problem with the mail server rather than PHP...

Hope this helps,
Jared
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Really Funny(9)
  2. How To: Connect, Read, Write, Close A Database(3)
  3. Phishing In Myspace(6)
  4. The Hacker's Google(29)
  5. Kde Starting Problem(4)
  6. Want To Make Your Oun PC Games Then Read This(6)
  7. DVD-Rom Doesn't Read DVDs(6)
  8. Need Support Urgently? Admin Absent? Read This...(15)
  9. Joke: Hilarious Classroom Quotes By Our Teachers(4)
  10. www And Non-www Version Of Your Webpages(16)
  11. Shmmni, Shmseg, Shmmax : How To Know The Current Value On Solaris ?(3)
  12. Security For Flash?(1)
  13. Read Errors With External Harddrive(6)
  14. Hottest Electronic News(7)
  15. Most Christians Did Not Read The Bible Completely,,is This Sane ?(28)
  1. Any Good Css Tuts?(7)
  2. Hosting Accounts In Read-only Mode(6)
  3. Your Home Server!(5)
  4. How To Bypass Bios Passwords.(10)
  5. Computers To Read Lips(2)
  6. Which Web Editor Software?(22)
  7. 'disk Read Error Message' On Start Up(5)
  8. Html Emails How?(12)
  9. Freebsd Commands..(1)
  10. Linux Only Recognises Usb Drive As Read-only(7)
  11. New Here, Read Some Other Posts...(1)
  12. Not Receiving Emails Since April 25(1)
  13. Trap17/computing Host(1)


 



- Lo-Fi Version Time is now: 21st August 2008 - 11:13 PM