forked from AndersonGroupPHInternal/HROnline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mailer.php
120 lines (111 loc) · 5.05 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
require 'PHPMailer/PHPMailerAutoload.php';
//Create a new PHPMailer instance
include('class.smtp.php');
include('class.phpmailer.php');
$ref = $_POST['ref'];
$concat = "";
//$email = $_POST['email'];
include('connect.php');
$select_ref = "select * from tbl_application where reference_no = '$ref'";
$result = $conn->query($select_ref);
while ($row = $result->fetch_assoc()) {
$position = $row['position'];
$fname = $row['fname'];
$lname = $row['lname'];
$mname = $row['mname'];
if($row["email_status"]==1){
if($row["hr_email"]==0){
$email='[email protected]';
$concat= "&&iNt3RvIs3w3r";
$mail_hr = "update tbl_application set `hr_email` = '1' where `reference_no` = '$ref'";
$conn->query($mail_hr);
}
}else{
$concat = "";
$email=$_POST['email'];//'[email protected]'; //
$mail_status = "update tbl_application set `email_status` = '1' where `reference_no` = '$ref'";
$conn->query($mail_status);
}
}
$result->free();
$mail = new PHPMailer;
$mail = isSMTP();
$mail->Host = 'smtp.gmail.com'
$mail->SMTPAuth = true;
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->Username = "[email protected]";
$mail->Password = "roldan060195";
$mail->setFrom('[email protected]','Anderson Group PH');
$mail->addReplyTo('[email protected]');
$mail->addAddress ($email);
$mail->isHTML(true);
$mail->AddEmbeddedImage('aga.png', 'logo', 'aga.png');
$bodyContent = "<a href='http://andersongroup.ph'><img style='text-align:center;' src='cid:logo'></a></br><hr >";
$bodyContent .= '<br>';
$bodyContent .= '<p>Dear Candidate,</p>';
$bodyContent .= '<br>';
$bodyContent .= '<p>Thank you for your interest in working with Anderson Group Philippines.</p>';
$bodyContent .= '<p>Please wait for further instructions from our recruitment team.</p>';
$bodyContent .= '<p>Should you not hear from us within the next 10 working days, feel free</p>';
$bodyContent .= '<p>to contact us at (+632) 4917325 to follow up on your application.</p>';
$bodyContent .= '<p>For your reference, your application code is : <a href="" style="text-decoration:none;"><b>'.$ref.'</b></a></p>';
$bodyContent .= 'To manage your application click the following link: <br>'
'<a href="http://andersongroup.ph/application/update_resume_form.php?ref='.$ref.'"> http://andersongroup.ph/application/update_resume_form.php?ref='.$ref.'</a>';
$bodyContent .= '<br>';
$bodyContent .= '<p>Thank you and Goodluck</p>';
$bodyContent .= '<br>';
$bodyContent .= '<p>Anderson Group PH</p>';
$mail->Subject = 'Anderson Group Philippines | Anderson.Recruits';
$mail->Body = $bodyContent;
$mail->AltBody = 'Anderson';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
if(isset($_POST["hr"])){
if($_POST["hr"]=="yes"){
$mail_hr2 = "update tbl_application set `hr_email` = '1' where `reference_no` = '$ref'";
$conn->query($mail_hr2);
$mail_notif = "select NAME, POSITION, TIMESTAMP FROM tbl_application where `reference_no` = '$ref'";
$result = $conn->query($mail_notif);
while ($row = $result->fetch_assoc()) {
$mail = new PHPMailer;
$mail->Host = 'relay-hosting.secureserver.net';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "Password123";
$mail->setFrom('[email protected]','Anderson Group PH');
$mail->addReplyTo('[email protected]');
$mail->addAddress("[email protected]");
//$mail->addAddress("[email protected]"); //acct:[email protected] password: anderson@123
$mail->isHTML(true);
$mail->Subject = "New Applicant";
$mail->AddEmbeddedImage('aga.png', 'logo', 'aga.png');
$bodyContent = "<a href='http://andersongroup.ph'><img style='text-align:center;' src='cid:logo'></a></br><hr >";
$bodyContent .= '<br>';
$bodyContent .= '<br>';
$bodyContent .= '<p>There is a new applicant applying for the position <a href="" style="text-decoration:none;"><b>'.$row["POSITION"].'</b></a>.</p>';
$bodyContent .= '<p><b>NAME:</b><a href="" style="text-decoration:none;"><b>'.$row["NAME"].'</b></a></p>';
$bodyContent .= '<p><b>DATE</b><a href="" style="text-decoration:none;"><b>'.$row["TIMESTAMP"].'</b></a></p>';
$bodyContent .= '<br>';
$bodyContent .= '<br>';
$bodyContent .= 'To assess your applicant click the following link: <br><a href="http://andersongroup.ph/application/update_resume_form.php?ref='.$ref.'">http://andersongroup.ph/application/update_resume_form.php?ref='.$ref.'</a>';
$bodyContent .= '<br>';
$bodyContent .= '<p>Thank you!</p>';
$bodyContent .= '<br>';
$bodyContent .= '<p>Anderson Group PH</p>';
$mail->Subject = 'Anderson Group Philippines | Anderson.Recruits';
$mail->Body = $bodyContent;
$mail->AltBody = 'Anderson';
}
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo"second message sent!";
}
}
}
}?>