-
Notifications
You must be signed in to change notification settings - Fork 0
/
contactUsMailer.php
executable file
·29 lines (28 loc) · 1.08 KB
/
contactUsMailer.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
<?php
header('Content-Type: application/json');
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['topic']) && isset($_POST['message'])) {
$name = strip_tags(mysql_escape_string($_POST['name']));
$email = strip_tags(mysql_escape_string($_POST['email']));
$topic = strip_tags(mysql_escape_string($_POST['topic']));
$message = strip_tags(mysql_escape_string($_POST['message']));
$body = "Name: ".$name."<br>Email: ".$email."<br>Topic: ".$topic."<br>Message: ".$message;
require './phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->setFrom($email, 'User Query');
$mail->addAddress('[email protected]', 'Dublin Kendo Email');
$mail->IsHTML(true);
$mail->Subject = "Website Contact";
$mail->MsgHTML($body);
$mail->CharSet="UTF-8";
if(!$mail->Send()) {
$return["success"] = false;
$return["message"] = "Mailer Error: ".$mail->ErrorInfo;
} else {
$return["success"] = true;
$return["message"] = "sent!";
}
echo json_encode($return);
} else {
echo "Access is denied.";
}
?>