My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @file conectar-email-imap.php
* @version 1.0
* @author Linea de Codigo (http://lineadecodigo.com)
* @date 24-marzo-2011
* @url http://lineadecodigo.com/php/descargar-emails-con-imap-y-php/
* @description Descargar emails mediante IMAP y PHP
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Descargar emails con IMAP y PHP</title>

</head>
<body>
<h1>Descargar emails con IMAP y PHP</h1>

<?php

$hostname = '{mail.aulambra.com:143/imap/ssl}INBOX';
$username = 'usuario@aulambra.com';
$password = 'password';


$inbox = imap_open($hostname,$username,$password) or die('Ha fallado la conexión: ' . imap_last_error());

$emails = imap_search($inbox,'FROM usuario@hotmail.com');

if($emails) {

$salida = '';

foreach($emails as $email_number) {
$overview = imap_fetch_overview($inbox,$email_number,0);
$salida.= '<p>Tema: '.$overview[0]->subject.'<br/>';
$salida.= 'De: '.$overview[0]->from.'</p>';
}

echo $salida;

}

imap_close($inbox);

?>

<br/><br/>
<hr>
Art&iacute;culo disponible en: <a href="http://lineadecodigo.com/php/descargar-emails-con-imap-y-php/">http://lineadecodigo.com/php/descargar-emails-con-imap-y-php/</a><br/>
<a href="http://lineadecodigo.com" title="Linea de Codigo">lineadecodigo.com</a>

</body>
</html>

Change log

r346 by vcuervo on Mar 23, 2011   Diff
Conectar email con IMAP
Go to: 
Project members, sign in to write a code review

Older revisions

r345 by vcuervo on Mar 23, 2011   Diff
Conectar email con IMAP
All revisions of this file

File info

Size: 1500 bytes, 56 lines
Powered by Google Project Hosting