-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit-contact-form.php
35 lines (26 loc) · 994 Bytes
/
submit-contact-form.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
<?php
header('Access-Control-Allow-Origin: *');
error_reporting(0);
// get values from client
$type = $_POST["type"];
$category = $_POST["category"];
$subject = $_POST["subject"];
$description = $_POST["description"];
// to send email
require("PHPMailer_5.2.4/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPDebug = 0;
include "mail-config.php";
$mail->AddAddress("xstack@mixspace.xyz");
$mail->addCC("danielmark.uc@gmail.com");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Contact form from MixSpace Website.";
$mail->Body = "Ticket Details</b><br>Type: " . $type . "<br>Category: " . $category . "<br>Subject: " . $subject . "<br>Description: " . $description . "<br><br><br><small>Submitted via submit-contact-form.php at mixspace.xyz.</small>";
if ($mail->Send()) {
echo json_encode("mail-success");
} else {
echo json_encode("mail-fail");
}
$conn->close();