Foren
Neue Beiträge
Foren durchsuchen
Was ist neu?
Neue Beiträge
Profilnachrichten
Online
Anmelden
Registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Neue Beiträge
Foren durchsuchen
Menü
Anmelden
Registrieren
App installieren
Installieren
Programmierung
CSS
Kontaktformular
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Auf Thema antworten
Beitrag
[QUOTE="Wassernelone, post: 14036, member: 4791"] Soweit bin ich nun Ich habe eine formular.php angelegt, mit diesem Code hinterlegt [CODE]<?php //Import PHPMailer class into the global namespace use PHPMailer\PHPMailer\PHPMailer; $msg = ''; //Don't run this unless we're handling a form submission if (array_key_exists('email', $_POST)) { date_default_timezone_set('Etc/UTC'); require '../vendor/autoload.php'; //Create a new PHPMailer instance $mail = new PHPMailer(); //Send using SMTP to localhost (faster and safer than using mail()) – requires a local mail server //See other examples for how to use a remote server such as gmail $mail->isSMTP(); $mail->Host = 'localhost'; $mail->Port = 25; //Use a fixed address in your own domain as the from address //**DO NOT** use the submitter's address here as it will be forgery //and will cause your messages to fail SPF checks $mail->setFrom('from@example.com', 'First Last'); //Choose who the message should be sent to //You don't have to use a <select> like in this example, you can simply use a fixed address //the important thing is *not* to trust an email address submitted from the form directly, //as an attacker can substitute their own and try to use your form to send spam $addresses = [ 'sales' => 'meinemail@gmx.de', 'support' => 'meinemail@gmx.de', 'accounts' => 'meinemail@gmx.de', ]; //Validate address selection before trying to use it if (array_key_exists('dept', $_POST) && array_key_exists($_POST['dept'], $addresses)) { $mail->addAddress($addresses[$_POST['dept']]); } else { //Fall back to a fixed address if dept selection is invalid or missing $mail->addAddress('meinemail@gmx.de'); } //Put the submitter's address in a reply-to header //This will fail if the address provided is invalid, //in which case we should ignore the whole request if ($mail->addReplyTo($_POST['email'], $_POST['name'])) { $mail->Subject = 'PHPMailer contact form'; //Keep it simple - don't use HTML $mail->isHTML(false); //Build a simple message body $mail->Body = <<<EOT Email: {$_POST['email']} Name: {$_POST['name']} Message: {$_POST['message']} EOT; //Send the message, check for errors if (!$mail->send()) { //The reason for failing to send will be in $mail->ErrorInfo //but it's unsafe to display errors directly to users - process the error, log it on your server. $msg = 'Sorry, something went wrong. Please try again later.'; } else { $msg = 'Email versendet.'; } } else { $msg = 'Invalid email address, message ignored.'; } } ?>[/CODE] Zusätzlich noch hier verlinkt <form action="formular.php" class="contact-form" method="post"> Allerdings weiß ich nicht ganz genau wie ich die PHPMailer Funktion installieren kann Ich hatte jetzt auch Kontakt mit IONOS, ein Formular[B] mit PHP8 ist weiterhin möglich[/B] [/QUOTE]
Zitate
Authentifizierung
Antworten
Programmierung
CSS
Kontaktformular
Oben
Unten