Get email with imap

Reply

Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Get email with imap

 
0
  #1
Aug 8th, 2008
hello,
i am having some problems retrieving email from gmail. im not sure if its because its pop or what. unfortunatly my host doesnt have the pop module. but here is the code.

  1.  
  2. $imap = imap_open("{pop.gmail.com:995}INBOX",
  3.  
  4. "username", "password");
  5. $messages = imap_sort($imap, SORTFROM, 1);
  6.  
  7. foreach ($messages as $message) {
  8. $header = imap_header($imap, $message);
  9. $prettydate = date("jS F Y", $header->udate);
  10. print "{$header->fromaddress} - $prettydate";?><br><?php
  11. }
  12.  
  13. imap_close($imap);

any help with this will be greatly appreciated.
Last edited by ProfessorPC; Aug 8th, 2008 at 5:03 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: Get email with imap

 
0
  #2
Aug 9th, 2008
Sorry, I have never done IMAP stuff with PHP (POP Yes) but luckily with all things Google there is plenty of documentation all over the web...

My first take is that you're using POP protocol on google's side of things pop.gmail.com:995 ...

This link suggests you need to enable IMAP on google before using it ...
http://mail.google.com/support/bin/a...y?answer=75725

This is someone who has already done it, maybe you can learn through example here ...
http://deepakssn.blogspot.com/2006/0...-php-with.html

This is the PHP main site discussion on using IMAP methods in PHP ...
http://us2.php.net/imap_open
Here I find useful nuggets like this ... possibly a useful example
  1. $mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX", "username@gmail.com", "password")
  2. or die("can't connect: " . imap_last_error());

Sorry I can't help you more

Good luck
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Re: Get email with imap

 
0
  #3
Aug 9th, 2008
I have found that the script does work on other servers. I think my host has me locked down a little more than i would like. Guess its time to look for that VPS i have been wanting.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC