-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
51 lines (44 loc) · 1.57 KB
/
contact.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
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get form data
$fullName = $_POST['your-name'];
$email = $_POST['your-email'];
$phoneNumber = $_POST['tel-922'];
$subject = $_POST['your-subject'];
$messageContent = $_POST['your-message'];
// Create a new PHPMailer instance
$mail = new PHPMailer;
// SMTP configuration
$mail->isSMTP();
$mail->Host = 'rbx107.truehost.cloud';
$mail->SMTPAuth = true;
$mail->Username = 'empowered360@qwixai.com';
$mail->Password = 'Hassanku190$';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
// Construct email message
$message = "Dear Regal Tours You have message from: \n\n";
$message .= "Full Name: " . $fullName . "\n";
$message .= "Email Address: " . $email . "\n";
$message .= "Phone Number: " . $phoneNumber . "\n";
$message .= "Subject: " . $subject . "\n";
$message .= "Message:\n" . $messageContent . "\n\n";
// Set email content
$mail->setFrom('empowered360@qwixai.com', 'Empowered 360');
$mail->addAddress('ramoshassan42@gmail.com'); // Replace with your email address
$mail->Subject = "Message from Visitor";
$mail->Body = $message;
// Send email
if ($mail->send()) {
echo 'Message has been sent successfully!';
} else {
echo 'Message could not be sent. Mailer Error: ' . $mail->ErrorInfo;
}
}
?>