Файловый менеджер - Редактировать - /home/clickysoft/public_html/hze-portal.clickysoft.net/process_form.php
Назад
<?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'vendor/autoload.php'; // Ensure PHPMailer is installed via Composer if ($_SERVER["REQUEST_METHOD"] === "POST") { $recaptcha_secret = "6LeK28gqAAAAAAy0iwOEK7_WY4Hoh0MbkG1U3k4F"; // Replace with your actual reCAPTCHA secret key $recaptcha_response = $_POST['recaptcha_response']; // Verify the reCAPTCHA response $verify_url = "https://www.google.com/recaptcha/api/siteverify?secret=$recaptcha_secret&response=$recaptcha_response"; $response = file_get_contents($verify_url); $response_data = json_decode($response); // if (!$response_data->success || $response_data->score < 0.5) { // die("reCAPTCHA validation failed. Please try again."); // } // If reCAPTCHA is valid, process the form data $organisation = htmlspecialchars($_POST['organisation']); $position = htmlspecialchars($_POST['position']); $firstname = htmlspecialchars($_POST['vorname']); $lastname = htmlspecialchars($_POST['name']); $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); $phone = htmlspecialchars($_POST['phone']); $message = htmlspecialchars($_POST['message']); // SMTP Configuration $mail = new PHPMailer(); try { // SMTP settings $mail->isSMTP(); $mail->CharSet="UTF-8"; $mail->SMTPAuth = true; $mail->Host = 'smtp.gmail.com'; $mail->Username = 'no-reply@hze-portal.de'; // Your SMTP username $mail->Password = 'robr tlvy dngh dpnw'; // Your SMTP password $mail->SMTPSecure = 'tls'; $mail->Port = 587; // Use port 587 for TLS // If SSL verification fails, use this temporarily $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ), ); // Email details $mail->setFrom('no-reply@hze-portal.de', 'HZE Portal'); // Set sender email $mail->addAddress('kontakt@hze-portal.de'); // Replace with recipient's email // $mail->addReplyTo('umairkhan.art23@gmail.com', $firstname . ' ' . $lastname); // Email content $mail->isHTML(true); $mail->Subject = "New Contact Form Submission"; $mail->Body = " <html> <head> <title>New Contact Form Submission</title> </head> <body> <h2>Contact Form Details</h2> <p><strong>Organisation:</strong> $organisation</p> <p><strong>Position:</strong> $position</p> <p><strong>Vorname:</strong> $firstname</p> <p><strong>Name:</strong> $lastname</p> <p><strong>E-Mail-Adresse:</strong> $email</p> <p><strong>Telefon:</strong> $phone</p> <p><strong>Nachricht:</strong><br>$message</p> </body> </html> "; // Send email if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; } } catch (Exception $e) { echo "Error: Your message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка