Es gibt jede Menge WordPress Kontaktformular Plugins Lösungen zum Beispiel (Contact Form 7), doch ohne Plugin geht auch.
Und so einfach geht das, eine PHP Datei (kontakt.php/contact.php) mit folgendem Inhalt im aktuellen Theme Ordner abzulegen.
Neue Seite in WordPress anlegen und als Template das Kontaktformular aktivieren.
< ?php /* Template Name: Kontaktformular */ if(isset($_POST['submitted'])) { if(trim($_POST['contactName']) === '') { $nameError = 'Fehler: Fullen Sie alle Felder aus!'; $hasError = true; } else { $name = trim($_POST['contactName']); } if(trim($_POST['contactEmail']) === '') { $emailError = 'Fehler: Fullen Sie alle Felder aus!'; $hasError = true; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['contactEmail']))) { $emailError = 'Die eMail-Adresse ist ungultig, korrigieren Sie die Eingabe.'; $hasError = true; } else { $eMail = trim($_POST['contactEmail']); } if(trim($_POST['contactSubject']) === '') { $subjectError = 'Fehler: Fullen Sie alle Felder aus!'; $hasError = true; } else { if(function_exists('stripslashes')) { $subject = stripslashes(trim($_POST['contactSubject'])); } else { $subject = trim($_POST['contactSubject']); } } if(trim($_POST['contactMessage']) === '') { $messageError = 'Fehler: Fullen Sie alle Felder aus!'; $hasError = true; } else { if(function_exists('stripslashes')) { $message = stripslashes(trim($_POST['contactMessage'])); } else { $message = trim($_POST['contactMessage']); } } if(!isset($hasError)) { $emailTo = get_option('admin_email'); $body = "Nachricht vom Blog gesendet:\n\nName: $name \neMail: $eMail \n\n". "Betreff: $subject \nNachricht: $message"; $headers = 'From: '.$name.' < '.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $eMail; mail($emailTo, $subject, $body, $headers); $emailSent = true; $sentmessage = "Nachricht erfolgreich gesendet"; } else { $sentmessage = $messageError; } } get_header() ?> <div id="wrapper"> <div id="content"> < ?php the_post() ?> <div id="post-<?php the_ID(); ?>" class="post"> <div class="entry-form"> </div> <div class="wpcf7" id="wpcf7-f2712-p20-o1"> <form action="<?php the_permalink(); ?>" method="post" class="wpcf7-form"> <div style="display: none;"> <input type="hidden" name="_wpcf7" value="2712"/> <input type="hidden" name="_wpcf7_version" value="3.2.1"/> <input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f2712-p20-o1"/> <input type="hidden" name="_wpnonce" value="77252d9cef"/> </div> <p>Ihr Name (Pflichtfeld)<br /> <span class="wpcf7-form-control-wrap your-name"><input type="text" name="contactName" value="" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="40"/></span> </p> <p>Ihre E-Mail-Adresse (Pflichtfeld)<br /> <span class="wpcf7-form-control-wrap your-email"><input type="text" name="contactEmail" value="" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" size="40"/></span> </p> <p>Betreff<br /> <span class="wpcf7-form-control-wrap your-subject"><input type="text" name="contactSubject" value="" class="wpcf7-form-control wpcf7-text" size="40"/></span> </p> <p>Ihre Nachricht<br /> <span class="wpcf7-form-control-wrap your-message"><textarea name="contactMessage" class="wpcf7-form-control wpcf7-textarea" cols="40" rows="10"></textarea></span> </p> <p><strong>< ?php echo $sentmessage; ?></strong></p> <p><input type="submit" name="submitted" value="Senden" class="wpcf7-form-control wpcf7-submit"/></p> <div class="wpcf7-response-output wpcf7-display-none"></div></form> </div> </div> </div> </div> < ?php get_sidebar(); get_footer(); ?>
Design Style einpassen, fertig.
Danke Stefan