-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEmail.html
More file actions
201 lines (175 loc) · 8.56 KB
/
Email.html
File metadata and controls
201 lines (175 loc) · 8.56 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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html>
<head>
<title>Email Client</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<!-- Stylesheet like a Bootstrap -->
<link rel="stylesheet" href="appjs/app.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
@-webkit-keyframes pulse {
0% {
background-color: #CCC;
}
25% {
background-color: #EEE;
}
50% {
background-color: #CCC;
}
75% {
background-color: #EEE;
}
100% {
background-color: #CCC;
}
}
</style>
</head>
<body>
<!-- Each window of app defined uniquely by div and not HTML documents -->
<div class="app-page" data-page="home">
<div class="app-topbar blue">
<div class="app-title">Send Email</div>
</div>
<div class="app-content">
<p class="app-section">
Click Below to Send an Email :
</p>
<div class="app-section" id="contactList">
</div>
<div class="app-section">
<div class="app-button" id="newUser" data-target="sendEmail">Send to New User</div>
</div>
</div>
</div>
<div class="app-page" data-page="sendEmail">
<div class="app-topbar blue">
<div class="app-title"><span class="app-icon"></span>Send Email</div>
<div class="right app-button" data-back>Done</div>
</div>
<div class="app-content">
<div class="app-section" id="message">
</div>
<div class="app-section">
From : <input class="app-input" id="From" name="From" type="email" placeholder="Sender's Email Address">
</div>
<div class="app-section">
To : <input class="app-input" id="To" name="To" type="email" placeholder="Receiver's Email Address">
</div>
<form class="app-section">
<input class="app-input" id="subject" name="subject" placeholder="Subject">
<textarea class="app-input" name="message" id="content" placeholder="Message"></textarea>
<div class="app-button green app-submit" id="sendButton">Send</div>
</form>
</div>
</div>
<!-- <script src="appjs/zepto.js"></script> -->
<script src="appjs/app.min.js"></script>
<script>
App.controller('home', function (page) {
if(typeof localStorage!== "undefined"){
$(page).find("#newUser")
.clickable()
.on("click",function(){
if(localStorage.getItem("To")!==null){
localStorage.removeItem("To");
}
App.load("sendEmail");
});
if(localStorage.getItem("recipientList")!==null){
var recipientList=new Array();
recipientList=JSON.parse(localStorage.getItem("recipientList"));
$.each(recipientList,function(index,value){
$(page).find("#contactList").append('<div class="app-button redirect">'+value+'</div>');
$(page).find("#contactList").show();
$(page).find(".redirect")
.clickable()
.on("click",function(){
localStorage.setItem("To",$(this).html());
App.load('sendEmail');
});
});
}else{
$(page).find("#contactList").hide();
}
}
});
App.controller('sendEmail', function (page) {
$(page).find("#message").hide();
/*$.ajax({
type: 'GET',
url: 'http://amarsinharanjan-com.stackstaging.com/content/10%20Mobile%20App/sendEmail.php?callback=response',
// data to be added to query string:
data: { to:"chandasinha70@gmail.com",from:"rob@robperci.com",subject:"test",content:"This is a drill."},
// type of data we are expecting in return:
dataType: 'jsonp',
timeout: 300,
context: $('body'),
success: function(data){
// Supposing this JSON payload was received:
// {"project": {"id": 42, "html": "<div>..." }}
// append the HTML to context object.
alert(data.success)
},
error: function(xhr, type){
alert('Ajax error!')
}
})*/
if(typeof localStorage!=="undefined"){
if(localStorage.getItem("From")!==null){
$(page).find("#From").val(localStorage.getItem("From"));
}
if(localStorage.getItem("To")!==null){
$(page).find("#To").val(localStorage.getItem("To"));
}
}
$(page).find("#sendButton")
.clickable()
.on("click",function(){
$.ajax({
type: 'GET',
url: 'http://amarsinharanjan-com.stackstaging.com/content/10%20Mobile%20App/sendEmail.php?callback=response',
// data to be added to query string:
data: { to: $("#To").val(), from: $("#From").val(), subject: $("#subject").val(), content: $("#content").val()},
// type of data we are expecting in return:
dataType: 'jsonp',
timeout: 300,
context: $('body'),
success: function(data){
if (data.success == true) {
$(page).find("#message").html("Your email was sent successfully!").show();
} else {
$(page).find("#message").html("Your email could not be sent - please try again later.").show();
}
},
error: function(xhr, type){
$(page).find("#message").html("Your email could not be sent - please try again later.").show();
}
})
if(typeof localStorage!=="undefined"){
// For showing Sender's Email Address for Email sending Client
localStorage.setItem("From",$("#From").val());
// For making a list of Recipients ..First check if the entered receiver's address is already added to the list if not ..then add the address to recipient's lists
var recipientList=new Array();
if(localStorage.getItem("recipientList")!==null){
recipientList=JSON.parse(localStorage.getItem("recipientList"));
}
if($.inArray($("#To").val(),recipientList)==-1){
recipientList.push($("#To").val());
recipientList.sort();
localStorage.setItem("recipientList",JSON.stringify(recipientList));
}
}else{
alert("locally not storable");
}
});
});
try {
App.restore();
} catch (err) {
App.load('home');
}
</script>
</body>
</html>