-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmail.php
More file actions
76 lines (68 loc) · 1.95 KB
/
mail.php
File metadata and controls
76 lines (68 loc) · 1.95 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?
include "config.php";
include "functions.php";
header("Cache-Control: no-cache");
header("Pragma: no-cache");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$nr = "";
$search = "";
$output = "";
$searchtxt = "";
if (isset ($_GET['nr']))
{
$nr = $_GET['nr'];
}
if (isset ($_GET['search']))
{
$searchtxt = $_GET['search'];
$search = $searchtxt . "@" . $maildomain;
}
if (strlen ($search) > 0 && strlen ($nr) > 0)
{
mb_internal_encoding("UTF-8");
$inbox = imap_open($hostname,$username,$password)
or die('Cannot connect to Gmail: ' . imap_last_error());
// $emails = imap_search($inbox,'ALL');
$emails = imap_search($inbox,'TO "' . $search . '"');
if($emails) {
rsort($emails);
foreach($emails as $email_number) {
if ($nr == $email_number)
{
$overview = imap_fetch_overview($inbox,$email_number,0);
getmsg($inbox,$email_number);
/*
foreach ($attachments as $attachment => $acontent)
{
var_dump ($attachment);
}
*/
if (strtolower ($charset) != "utf-8")
{
$htmlmsg = utf8_encode ($htmlmsg);
$plainmsg = utf8_encode ($plainmsg);
}
$message = $htmlmsg; // Default
if (strlen ($plainmsg) > strlen ($htmlmsg))
{
$message = $plainmsg; // Fallback
header("Content-Type: text/plain");
} else {
header("Content-Type: text/html; charset=utf-8");
}
$alt = array ("=C4","=D6","=DC" ,"=DF" ,"=E4" ,"=F6" ,"=FC", "=A1", "=BF", "=E1",
"=E9","=ED","=F3" ,"=FA" ,"=F1" ,"=D1" ,"=E0", "=E2", "=E7", "=F4",
"=E9","=E8","=EA" ,"=EB" ,"=EE" ,"=FB" ,"=F9" ,"=BD", "=3D", "=A7",
"=B0","=20","=0A=","=\r\n");
$neu = array( "Ä","Ö","Ü","ß","ä","ö","ü","¡","¿","á",
"é","í","ó","ú","ñ","Ñ","à","â","ç","ô",
"é","è","ê","ë","î","û","ù","œ","=","§",
"°"," "," ","\r\n");
echo str_replace($alt,$neu,$message);
}
}
}
imap_close($inbox);
}
?>