Cita:
Iniciado por Sourcegeek Me arme esto ¿Puede andar? como sigo
<?php
//************************************************** *************************************************
//Connecting to the mailbox
//To connect to a POP3 mail server, do the following, where $server contains the server to connect to, $login and $password the login name
//and password used to access the mailbox:
//************************************************** *************************************************
$connection = imap_open('{$server:110/pop3}', $login, $password);
//************************************************** *************************************************
//If it's an IMAP server you can leave out the port number and slash part:
//************************************************** *************************************************
$connection = imap_open('{$server}', $login, $password);
//************************************************** *************************************************
//The value returned will either be an IMAP resource or boolean false in the event of an error.
//Note that if you're getting "Warning: imap_open(): Couldn't open stream" type of errors when connecting you may need to append the //notls flag after the server e.g.:
//************************************************** *************************************************
$connection = imap_open('{$server/notls}', $login, $password);
//************************************************** *************************************************
//To get the number of messages in the mailbox use the imap_num_msg() function like so:
//************************************************** *************************************************
$count = imap_num_msg($connection);
//************************************************** *************************************************
//Use a simple loop to loop through from 1 to the number of messages combined with the imap_headerinfo and imap_body functions to get the //message headers formatted into an object and the raw body respectively.
//************************************************** *************************************************
for($i = 1; $i <= $count; $i++) {
$header = imap_headerinfo($connection, $i);
$raw_body = imap_body($connection, $i);
}
//************************************************** *************************************************
//The value returned from the imap_headerinfo() function is an object containing a number of properties. To show the values available, an //example of the output from print_r is as follows:
//************************************************** *************************************************
stdClass Object
(
[date] => Wed, 4 Feb 2009 22:37:42 +1300
[Date] => Wed, 4 Feb 2009 22:37:42 +1300
[subject] => Fwd: another test
[Subject] => Fwd: another test
[in_reply_to] => <
[email protected] xample.com>
[message_id] => <59f89e00902040137s16c317b6oa4658a4d2cc64c3c@mail. example.com>
[references] => <
[email protected] xample.com>
[toaddress] =>
[email protected]
[to] => Array
(
[0] => stdClass Object
(
[mailbox] => john
[host] => example.com
)
)
[fromaddress] => Chris Hope
[from] => Array
(
[0] => stdClass Object
(
[personal] => Chris Hope
[mailbox] => chris
[host] => example.com
)
)
[reply_toaddress] => Chris Hope
[reply_to] => Array
(
[0] => stdClass Object
(
[personal] => Chris Hope
[mailbox] => chris
[host] => example.com
)
)
[senderaddress] => Chris Hope
[sender] => Array
(
[0] => stdClass Object
(
[personal] => Chris Hope
[mailbox] => chris
[host] => example.com
)
)
[Recent] => N
[Unseen] =>
[Flagged] =>
[Answered] =>
[Deleted] =>
[Draft] =>
[Msgno] => 20
[MailDate] => 4-Feb-2009 22:37:42 +1300
[Size] => 3111
[udate] => 1233740262
)
?>