-
Notifications
You must be signed in to change notification settings - Fork 0
/
gethired.php
50 lines (49 loc) · 1.4 KB
/
gethired.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
<html>
<head>
<link href="css/style.css" rel='stylesheet' type='text/css' />
<title>Confirmation</title>
</head>
<?php
require_once('PHPMailer/class.phpmailer.php');
include("PHPMailer/class.smtp.php");
require ('PHPMailer/PHPMailerAutoload.php');
//$name=$_POST["name"];
//$email=$_POST["email"];
//$message=$_POST["message"];
$name="Harsha";
$email="[email protected]";
$message="Hiee";
if(strcmp($name,"")){
$message="Name: ".$name."\nEmail: ".$email."\nMessage: ".$message;
smtpmailer('youremail', $email, 'Request for Querry', 'Hiring', $message);
echo $error;
}
else{
$mess='<br></br><br></br><center><h2>Please enter your Details.....</h2></center>';
echo $mess;
}
function smtpmailer($to, $from, $from_name, $subject, $body) {
global $error;
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = 'youremail';
$mail->Password = 'password';
$mail->SetFrom($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
}
?>
</html>