-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
77 lines (75 loc) · 2.92 KB
/
index.html
File metadata and controls
77 lines (75 loc) · 2.92 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Send email in nodejs</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>
<div class="panel panel-primary" style="width:50%;margin:0 auto; margin-top:10%">
<div class="panel-heading"><h3>Email Form In Node.Js</h3></div>
<div class="panel-body" style="height:40%; text-align:center;" >
<p class="bg-info" id="msg"></p>
<form class="form-horizontal" role="form" id="emailForm" method="post">
<div class="form-group">
<label class="control-label col-sm-2" for="email1">From_Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email1" placeholder="Enter from email" required="required">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="email2">To_Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="email2" placeholder="Enter to email" required="required">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="subject">Subject:</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="subject" placeholder="Enter subject" required="required">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="description">Description:</label>
<div class="col-sm-10">
<textarea class="form-control" name="description" placeholder="Enter Description"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button id="send" class="btn btn-primary btn-lg" type="button">
<span class="glyphicon glyphicon-send" ></span> Send
</button>
</div>
</div>
</form>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
$(function(){
var fullUrl = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: '');
$("#send").click(function(){
var formData = $("#emailForm").serialize();
$("#msg").text("Email sending Please wait..");
$.ajax({
url: fullUrl+'/send',
type: 'POST',
data: formData,
success: function(result) {
$("#msg").empty().text(result);
},
error: function(e) {
$("#msg").empty().text("There is some error to send email, Error code:"+e.status +", Error message:"+e.statusText);
},
dataType: "html",
timeout: 60000
});
});
});
</script>
</body>
</html>