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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.