My favorites
▼
|
Sign in
lineadecodigo
Web Code Samples in spanish
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
lineadecodigo_php
/
email
/
descagar-email-de-gmail.php
r478
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
57
<?php
/**
* @file conectar-email-pop3.php
* @version 1.0
* @author Linea de Codigo (http://lineadecodigo.com)
* @date 22-marzo-2011
* @url http://lineadecodigo.com/php/descargar-emails-de-gmail-con-php/
* @description Descargar emails mediante POP3 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 de GMail con PHP</title>
</head>
<body>
<h1>Descargar emails de GMail con PHP</h1>
<?php
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'usuario@gmail.com';
$password = 'password';
$inbox = imap_open($hostname,$username,$password) or die('Ha fallado la conexión: ' . imap_last_error());
$emails = imap_search($inbox,'ALL');
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ículo disponible en: <a href="http://lineadecodigo.com/php/descargar-emails-de-gmail-con-php/">http://lineadecodigo.com/php/descargar-emails-de-gmail-con-php/</a><br/>
<a href="http://lineadecodigo.com" title="Linea de Codigo">lineadecodigo.com</a>
</body>
</html>
Show details
Hide details
Change log
r347
by vcuervo on Mar 23, 2011
Diff
Descargar emails de GMail con PHP
Go to:
...mail/descagar-email-de-gmail.php
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1485 bytes, 57 lines
View raw file
Powered by
Google Project Hosting