raimis100 Posted February 19, 2009 Share Posted February 19, 2009 Hey! I am looking all around the net and I can only find scripts which sends messages but cannot find one which would just read mail. Is there a way to read incoming mails in gmail using like XPertMailer, Zend Framework Mail, PHPMailer or PEAR Mail ? Link to comment https://forums.phpfreaks.com/topic/145927-solved-read-gmail-with-php/ Share on other sites More sharing options...
raimis100 Posted February 19, 2009 Author Share Posted February 19, 2009 okey, Found a way with imap_open used script: set_time_limit (120); //$mbox = imap_open("{mail.google.com:143}", "raimon", "pass"); $mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX", "raimisy", "LoL") or die("can't connect: " . imap_last_error()); echo "<h1>Mailboxes</h1>\n"; $folders = imap_listmailbox($mbox, "{imap.gmail.com:993/imap/ssl}INBOX", "*"); if ($folders == false) { echo "Call failed<br />\n"; } else { foreach ($folders as $val) { echo $val . "<br />\n"; } } echo "<h1>Headers in INBOX</h1>\n"; $headers = imap_headers($mbox); if ($headers == false) { echo "Call failed<br />\n"; } else { foreach ($headers as $val) { echo $val . "<br />\n"; } } imap_close($mbox); But it just reads the title of all emails, how can I actually get the content ? edit: edited password Link to comment https://forums.phpfreaks.com/topic/145927-solved-read-gmail-with-php/#findComment-766105 Share on other sites More sharing options...
thebadbad Posted February 19, 2009 Share Posted February 19, 2009 Have a look at imap_body() and maybe some of the other imap functions. And remember to 'star out' your username and password when you share your code with others! Link to comment https://forums.phpfreaks.com/topic/145927-solved-read-gmail-with-php/#findComment-766126 Share on other sites More sharing options...
raimis100 Posted February 19, 2009 Author Share Posted February 19, 2009 I tough I removed it, lol Got it working, thanks! Link to comment https://forums.phpfreaks.com/topic/145927-solved-read-gmail-with-php/#findComment-766398 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.