-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendmail.php
94 lines (74 loc) · 2.76 KB
/
sendmail.php
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Revolutionary life - Living Stones</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Registration Website">
<meta name="author" content="Samuel Thampy">
<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<style>
</style>
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="../assets/js/html5shiv.js"></script>
<![endif]-->
<script src="js/jquery-2.1.0.min.js"></script>
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="../assets/ico/favicon.png">
</head>
<body>
<form action="sendmail.php" method="post" >
<div class="form-group">
<label for="firstname" class="col-md-2">
From:
</label>
<div class="col-md-10">
<input type="text" class="form-control" id="from" name="from" placeholder="Sender's Name">
</div>
</div>
<div class="form-group">
<label for="firstname" class="col-md-2">
Subject:
</label>
<div class="col-md-10">
<input type="text" class="form-control" id="subject" name="subject" placeholder="Subject">
</div>
</div>
<div class="form-group">
<label for="lastname" class="col-md-2">
Message:
</label>
<div class="col-md-10">
<textarea name="message" rows="10" cols="150" placeholder="Message"></textarea>
</div>
</div>
<div class="col-md-2">
<input type="submit" name ="send" class="btn btn-info" value="Send">
</div>
</form>
<?php
include_once('dbconnect.php');
$sql = "select firstname, lastname, emailaddress from registration_table";
$result = mysql_query($sql, $link);
if(!$result){
die('Error:'.mysql_error());
}
if(isset($_POST['send'])){
$message = $_POST['message'];
$from = $_POST['from'];
$subject = $_POST['subject'];
ini_set("SMTP","aspmx.l.google.com");
while($row = mysql_fetch_array($result)){
mail($row['emailaddress'],$subject,"Dear ".$row['firstname']." ".$row['lastname'].",\n\n $message \n\nThanks and Regards\n$from");
}
}
?>
</body>
</html>