-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit.html
83 lines (49 loc) · 2.32 KB
/
submit.html
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
<?php
// call the contact() function if contact_btn is clicked
if (isset($_POST['contact_btn'])) {
contact();
}
function contact()
{
if (isset($_POST["contact_btn"])) {
include('smtp/PHPMailerAutoload.php');
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$phone_number = $_POST["phone_number"];
$message = $_POST["message"];
// Email Functionality
date_default_timezone_set('Etc/UTC');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "smtp.mailtrap.io"; // SMTP server example
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 2525; // set the SMTP port for the GMAIL server
$mail->Username = "dffb251aa1bba7"; // SMTP account username example
$mail->Password = "82643e4f9e62db"; // SMTP account password example
$mail->setFrom($_POST['email']);
$mail->addAddress('jagadeeshbose2001@gmail.com');
// The subject of the message.
$mail->Subject = 'Received Message From Client ' . $name;
$message = '<html><body>';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>" . strip_tags($_POST['name']) . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" . strip_tags($_POST['email']) . "</td></tr>";
$message .= "<tr><td><strong>subject:</strong> </td><td>" . strip_tags($_POST['subject']) . "</td></tr>";
$message .= "<tr><td><strong>phone_number:</strong> </td><td>" . strip_tags($_POST['phone_number']) . "</td></tr>";
$message .= "<tr><td><strong>message</strong> </td><td>" . strip_tags($_POST['message']) . "</td></tr>";
$message .= "</table>";
$message .= "</body></html>";
$mail->Body = $message;
$mail->isHTML(true);
if ($mail->send()) {
echo header("Location:contact.html");
"Message could not be sent. ";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
}
}
?>