-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.html
155 lines (125 loc) · 4.53 KB
/
index.html
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tempy</title>
<link rel='stylesheet' href='//cdn.repl.email/styles/water.css'>
<link rel="icon" href="mail.png">
<link rel='manifest' href='manifest.json'>
<style>
#status {
position: fixed;
bottom: 0;
left: 0;
width: 100vw;
height: 20px;
text-align: center;
color: gray;
}
.qa{
color: green;
}
.qa-answer{
font-weight: bold;
}
</style>
</head>
<body>
<h1><a href="/">Tempy</a></h1>
<div id='about'>
<h3 class='qa'>What is this service for?</h3>
<p class='qa-answer'>
Tempy is a free service that offers temporary, disposable mailboxes to receive emails from.
Bear in mind, emails can be accessed by anyone that knows your address.
</p>
<h3 class='qa'>Can I use a custom address?</h3>
<p class='qa-answer'>
Yes. The user (part before the <code>@</code> sign) can be changed to anything.
</p>
<button onclick='$("#about").hide()'>Hide</button>
</div>
<hr>
<input id='addr' placeholder="email address" style='width: 49%'>
<button onclick='refreshMail()'>Load Mail</button>
<button onclick="genEmail()">New Address</button>
<hr>
<table id='emails'></table>
<footer id='status'>
Powered By <a href='https://1secmail.com'>1secMail</a>
-
Created By <a href='https://navaneethkm.gq'>Navaneeth K M</a>
</footer>
<script src='//code.jquery.com/jquery.min.js'></script>
<!-- Add back when dupl analytics is working
<script src='//analytics.dupl.tech/analytics.js'></script>
-->
<script>
function genEmail() {
$.getJSON("https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1", (res) => {
$('#addr').val(res[0]);
refreshMail();
})
}
function refreshMail() {
addr = $('#addr').val();
if (!addr) {
alert("Please generate or input an email address first!");
return
}
user = addr.split('@')[0];
domain = addr.split('@')[1];
$.getJSON(`https://www.1secmail.com/api/v1/?action=getMessages&login=${user}&domain=${domain}`, (emails) => {
$('#emails').empty();
$('#emails').append($(`
<tr>
<th><b>ID</b></th>
<th><b>From</b></th>
<th><b>Subject</b></th>
<th><b>Date</b></th>
<th><b>Content</b></th>
</tr>
`));
for (i in emails) {
email = emails[i];
$('#emails').append($(`
<tr>
<td>${email['id']}</td>
<td>${email['from']}</td>
<td>${email['subject']}</td>
<td>${email['date']}</td>
<td id="${email['id']}"><a onclick="loadEmail('${email['id']}')">Load content...</a></td>
</tr>
`))
}
})
}
function loadEmail(id) {
addr = $('#addr').val();
if (!addr) {
alert("Please generate or input an email address first!");
return
}
user = addr.split('@')[0];
domain = addr.split('@')[1];
$.getJSON(`https://www.1secmail.com/api/v1/?action=readMessage&login=${user}&domain=${domain}&id=${id}`, (email) => {
elm = $(`#${id}`);
if (email['htmlBody']) {
elm.html(email['htmlBody']);
} else {
elm.text(email['body']);
}
atts = $('<div></div>');
for (i in email['attachments']) {
file = email['attachments'][i];
atts.append($(`<a href='https://www.1secmail.com/api/v1/?action=download&login=${user}&domain=${domain}&id=${id}&file=${file['filename']}'>${file['filename']}</a>`));
}
elm.append(atts);
})
}
$(function() {
genEmail();
})
</script>
</body>
</html>