Using POP3 with PHP

Posted: February 12, 2010 in Uncategorized

We all know, using SMTP (Sending Mail with PHP). This article covers, how to use POP3 (Receive Mail). Here is the code;

$mbox = imap_open(“{pop.gmail.com:995/pop3/ssl}”, “userid@gmail.com”, “password”);

echo “reached here\n”;

echo “Mailboxes\\n”;

$folders = imap_listmailbox($mbox, “{pop.gmail.com:995}”, “*”);

if ($folders == false) {
echo “Call failed
\n”;
} else {
foreach ($folders as $val) {
echo $val . ”
\n”;
}
}

echo “HEADERS IN INBOX”;

foreach ($headers as $val) {
echo $val . ”
\n”;
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s