fixed Boterkennung durch Zeit.
Formular Zusatzmodule Freiberufler hinzugefügt. message.php constructMessage() erweitert, so dass für alle Formulare nur diese eine Methode benötigt wird.
This commit is contained in:
parent
7a9bcaaef8
commit
022802a9a5
3 changed files with 251 additions and 0 deletions
47
public/php/mail.php
Normal file
47
public/php/mail.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
require 'vendor/autoload.php'; // Pfad zum Composer autoload.php anpassen
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
// Eingabedaten empfangen und validieren
|
||||
$name = strip_tags(trim($_POST['name']));
|
||||
$email = filter_var(trim($_POST['email']), FILTER_SANITIZE_EMAIL);
|
||||
$message = trim($_POST['message']);
|
||||
|
||||
if (empty($name) || !filter_var($email, FILTER_VALIDATE_EMAIL) || empty($message)) {
|
||||
// Ungültige Eingabe
|
||||
throw new Exception('Ungültige Eingabedaten.');
|
||||
}
|
||||
|
||||
// Servereinstellungen
|
||||
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Aktivieren Sie dies für detailliertes Debugging
|
||||
$mail->isSMTP(); // SMTP verwenden
|
||||
$mail->Host = 'sslout.de'; // SMTP-Server setzen
|
||||
$mail->SMTPAuth = true; // SMTP-Authentifizierung aktivieren
|
||||
$mail->Username = 'ah@mediendesign-hnida.de'; // SMTP-Benutzernamen angeben
|
||||
$mail->Password = 'jrd9h7RnVjf/'; // SMTP-Passwort angeben
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // Verschlüsselung aktivieren
|
||||
$mail->Port = 465; // TCP-Port für die Verbindung
|
||||
|
||||
// Empfänger
|
||||
$mail->setFrom($email, $name); // Absenderadresse
|
||||
$mail->addAddress('ah@mediendesign-hnida.de', 'Andreas Hnida'); // Empfänger hinzufügen
|
||||
$mail->addReplyTo($email, $name); // Antwortadresse setzen
|
||||
$mail->addBCC('ah@mediendesign-hnida.de'); // Bounce-E-Mail-Adresse als BCC hinzufügen
|
||||
|
||||
// Inhalt
|
||||
$mail->isHTML(true); // E-Mail im HTML-Format
|
||||
$mail->Subject = 'Neue Nachricht vom Bestellformular der Website';
|
||||
$mail->Body = nl2br(htmlspecialchars($message));
|
||||
$mail->AltBody = htmlspecialchars($message);
|
||||
|
||||
$mail->send();
|
||||
echo 'Nachricht wurde gesendet';
|
||||
} catch (Exception $e) {
|
||||
echo "Nachricht konnte nicht gesendet werden. Fehler: {$mail->ErrorInfo}";
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue