Merge branch 'contactform' into staging
All checks were successful
Deploy Hugo / deploy (push) Successful in 39s
All checks were successful
Deploy Hugo / deploy (push) Successful in 39s
This commit is contained in:
commit
af701086bf
@ -6,35 +6,36 @@ require 'PHPMailer/src/SMTP.php';
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
// Lade die Konfigurationsdatei
|
||||
$config = require '/var/www/vhosts/hosting205886.ae948.netcup.net/bar-filipo.de/credentials/config.php';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$name = htmlspecialchars($_POST['name']);
|
||||
$email = htmlspecialchars($_POST['email']);
|
||||
$message = htmlspecialchars($_POST['message']);
|
||||
|
||||
$config = parse_ini_file('/var/www/vhosts/hosting205886.ae948.netcup.net/bar-filipo.de/credentials/config.ini', true);
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
// SMTP-Einstellungen aus der Konfigurationsdatei laden
|
||||
$mail->isSMTP();
|
||||
$mail->Host = $config['smtp_host'];
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = $config['smtp_username'];
|
||||
$mail->Password = $config['smtp_password'];
|
||||
$mail->SMTPSecure = $config['smtp_encryption'];
|
||||
$mail->Port = $config['smtp_port'];
|
||||
$mail->SMTPDebug = 2;
|
||||
$mail->Debugoutput = 'echo';
|
||||
$mail->Host = $config['smtp']['host'];
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = $config['smtp']['username'];
|
||||
$mail->Password = $config['smtp']['password'];
|
||||
$mail->SMTPAutoTLS = true;
|
||||
$mail->Port = $config['smtp']['port'];
|
||||
|
||||
// E-Mail-Einstellungen
|
||||
$mail->setFrom($config['smtp_username'], 'Formular-Betreiber');
|
||||
$mail->addAddress($config['recipient']);
|
||||
$mail->setFrom($config['smtp']['username'], 'Formular-Betreiber');
|
||||
$mail->addAddress($config['smtp']['recipient']);
|
||||
|
||||
$mail->isHTML(true);
|
||||
$mail->Subject = 'Neue Nachricht vom Kontaktformular';
|
||||
$mail->Body = "Name: $name<br>E-Mail: $email<br>Nachricht: $message";
|
||||
$mail->AltBody = "Name: $name\nE-Mail: $email\nNachricht: $message";
|
||||
|
||||
print_r($config);
|
||||
$mail->send();
|
||||
echo 'Nachricht wurde erfolgreich gesendet.';
|
||||
} catch (Exception $e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user