-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuccess_reg.php
56 lines (44 loc) · 2.12 KB
/
success_reg.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
<?php
session_start();
$studentid = $_SESSION['s_id'];
include 'library.php'; // include the library file
include "classes/class.phpmailer.php"; // include the class name
$host="localhost";
$user="root";
$pass="root";
$con = mysql_connect("$host","$user","$pass");
if (!$con)
{
echo "Error in DBConnect() = " . mssql_get_last_message();
die('Could not connect: ' . mysql_error());
}
mysql_select_db("placement", $con);
$sql = "SELECT * from stud_login where sid='{$studentid}'";
$result = mysql_query($sql,$con);
$row=mysql_fetch_array($result);
$username = $row['username'];
$email = $row['email'];
$sid= $studentid;
//$email = $_POST["email"];
$mail = new PHPMailer; // call the class
$mail->IsSMTP();
$mail->Host = SMTP_HOST; //Hostname of the mail server
$mail->Port = SMTP_PORT; //Port of the SMTP like to be 25, 80, 465 or 587
$mail->SMTPAuth = true; //Whether to use SMTP authentication
$mail->Username = SMTP_UNAME; //Username for SMTP authentication any valid email created in your domain
$mail->Password = SMTP_PWORD; //Password for SMTP authentication
$mail->AddReplyTo("[email protected]", "Placement Reply"); //reply-to address
$mail->SetFrom("[email protected]", "Placement Cell"); //From address of the mail
// put your while loop here like below,
$mail->Subject = "Your Placement Registeration"; //Subject od your mail
$mail->AddAddress($email, "placement cell"); //To address who will receive this email
$mail->MsgHTML("<b>Hello<p>Thank you for registering with Placement Cell. We welcome you on board and hope to have a great opportunities ahead, together.</p><br><img src="."http://www.psgnursing.ac.in/wp-content/uploads/2012/06/placement.jpg".">"); //Put your body of the message you can place html code here
//$mail->AddAttachment("email-pic/pl.jpg"); //Attach a file here if any or comment this line,
$send = $mail->Send(); //Send the mails
if($send){
header('Location:success.php');
}
else{
echo '<center><h3 style="color:#FF3300;">Mail error: </h3></center>'.$mail->ErrorInfo;
}
?>