Jump to content

[SOLVED] read gmail with php


raimis100

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.