-
Notifications
You must be signed in to change notification settings - Fork 0
/
mailer.php
64 lines (51 loc) · 2.11 KB
/
mailer.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
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.1.min.js"></script>
<script src="f_clone_Notify.js" type="text/javascript"></script>
<link href="f_clone_Notify.css" rel="stylesheet" />
<style>
.box
{
height:100px;
width:100px;
border: solid;
}
</style>
</head>
</html>
<?php
session_start();
require_once 'PHPMailer/PHPMailerAutoload.php';
$em=$_GET['email'];
$mail = new PHPMailer;
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "rohitcube00@gmail.com"; // SMTP account username
$mail->Password = "rohitcube"; // SMTP account password
$mail->From = "rohitcube00@gmail.com";
$mail->FromName = "Rohit Cube";
$mail->addAddress("$em");
$mail->IsHTML(true);
$mail->Subject = "Hello Your group code is ";
$con=mysql_connect('localhost',"root","");
if(!$con)
{
die("Could not connect:".mysql_error());
}
mysql_select_db("r.e.d_db",$con);
//$sql=mysql_query("SELECT * from teacher_create_group where group_id='$_SESSION[email]'");
//$row= mysql_fetch_assoc($sql);
$code=$_SESSION['group_code'];
$mail->Body = "<div style='background-color:#82b1ff blue accent-1;'><font style='color:blue;'><h4>Welcome to Rohit's Educational Cube.</h4></font></div>"
. "<br>To join our Classroom add group code during sign up. Your group code is: <b>$code</b></div></td></tr></tbody></table>";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
header("location:home_page_teacher.php");
}
?>