email client - getting email from the server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nowandagain
Forum Newbie
Posts: 3
Joined: Thu Aug 05, 2010 2:35 pm

email client - getting email from the server

Post by nowandagain »

Hi

I was just wondering if anyone could tell me what is wrong with this code. For a web application I want to connect to my email supplier with whom I have an account. I am trying to make a basic connection using imap, to simply test this is possible. I have looked around and have been unable to find sources that would help me, as I understand it, this particular method should be working.

Code: Select all

<?php
//Open an IMAP connection
$user = "##";
$password = "##";
$ms = imap_open("{mail.yahoo.com}INBOX", $user, $password);
$message = imap_num_msg($ms);
echo "<p> User $user has $message in his inbox.</p>";

?>
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: email client - getting email from the server

Post by Weirdan »

As far as I can tell, you can't use php's imap extension to connect to yahoo's imap servers because they use slightly different protocol (1 more command to send before login): http://en.wikipedia.org/wiki/Yahoo!_Mai ... TPs_access
nowandagain
Forum Newbie
Posts: 3
Joined: Thu Aug 05, 2010 2:35 pm

Re: email client - getting email from the server

Post by nowandagain »

Thanks weirden for your reply.

Am I coming from the wrong angle, I am trying to create a PHP client to read email. I need it to be a working proto-type. Is IMAP the right solution. I was trying to connect to BTinternet.com as I already have an active account. I also have an MS outlook account at my University, would I still need to insert the GU ID = 1 statement for login.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: email client - getting email from the server

Post by Weirdan »

Most likely you won't need GUID command with any imap server other than Yahoo's.
nowandagain
Forum Newbie
Posts: 3
Joined: Thu Aug 05, 2010 2:35 pm

Re: email client - getting email from the server

Post by nowandagain »

thanks
Post Reply