forked from Lokesh-Anand/HospitalManagement
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendreg.php
More file actions
65 lines (54 loc) · 2.09 KB
/
sendreg.php
File metadata and controls
65 lines (54 loc) · 2.09 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
<?php
require("common.php");
require("PHPMailer/PHPMailerAutoload.php");
$name=$_POST['new_name'];
$age=$_POST['new_age'];
$qual=$_POST['new_qual'];
$dept=$_POST['new_role'];
$add=$_POST['new_address'];
$mail=$_POST['new_mail'];
$gender=$_POST['new_gender'];
$contact=$_POST['new_con'];
$to = "lokesha805@gmail.com";
$fileName=$_FILES['new_pic']['name'];
$tmpName=$_FILES['new_pic']['tmp_name'];
$fileSize=$_FILES['new_pic']['size'];
$fileType=$_FILES['new_pic']['type'];
$body="<p>Name:$name</p> <p>Age:$age</p><p>qual:$qual</p><p>department:$dept</p><p>Address:$add</p>
<p>Email:$mail</p><p>gender:$gender</p><p>contact:$contact</p>";
$Mail = new PHPMailer();
$Mail->IsSMTP(); // Use SMTP
$Mail->Host = "smtp.gmail.com"; // Sets SMTP server for gmail
$Mail->SMTPDebug = 0; // 2 to enable SMTP debug information
$Mail->SMTPAuth = TRUE; // enable SMTP authentication
$Mail->SMTPSecure = "tls"; //Secure conection
$Mail->Port = 587; // set the SMTP port to gmail's port
$Mail->Username = 'lokesha805'; // gmail account username
$Mail->Password = '4rfv5tgb6yhn'; // gmail account password
$Mail->Priority = 1; // Highest priority - Email priority (1 = High, 3 = Normal, 5 = low)
$Mail->CharSet = 'UTF-8';
$Mail->Encoding = '8bit';
$Mail->Subject = 'Recruitment Application';
$Mail->ContentType = 'text/html; charset=utf-8\r\n';
$Mail->From = 'lokesha805@gmail.com'; //Your email adress (Gmail overwrites it anyway)
$Mail->FromName = 'lokesh';
$Mail->WordWrap = 900; // RFC 2822 Compliant for Max 998 characters per line
$Mail->addAddress($to); // To
$Mail->isHTML( TRUE );
$Mail->Body = $body;
$Mail->AltBody = 'This is a recovery mail';
if (isset($_FILES['new_pic']) &&
$_FILES['new_pic']['error'] == UPLOAD_ERR_OK)
{
$Mail->AddAttachment($tmpName,
$fileName);
}
if(!$Mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $Mail->ErrorInfo;
exit;
}
$Mail->SmtpClose();
echo 'Message has been sent';
header("Location: index.php");
?>