Formmailer: Email Formular mit Website Baker versenden

Eine sehr saubere und sichere Methode ist die Benutzung des php - Formmailers. Das ist eine kleine php-Klasse, die Sie einfach in Ihr Template einbinden können. Insbesondere sind die Formulare so vor Spammern geschützt.
Den PHP Formmailer gibt es hier zum Download.
Beispiel der Benutzung des Formmailers:
Code
<?php
require_once('../class.phpmailer.php');
$mail = new PHPMailer(); // Defaultmäßig wird PHP mail() - Funktion benutzt
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com","First Last");
$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");
$mail->Subject = "Die Betreff - Zeile";
$mail->AltBody = "Um die Nachricht anzusehen benutzen Sie einen HTML kompatiblen Viewer!";
$mail->MsgHTML($body);
$mail->AddAttachment("images/phpmailer.gif"); // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Nachricht gesendet!";
}
?>
require_once('../class.phpmailer.php');
$mail = new PHPMailer(); // Defaultmäßig wird PHP mail() - Funktion benutzt
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com","First Last");
$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");
$mail->Subject = "Die Betreff - Zeile";
$mail->AltBody = "Um die Nachricht anzusehen benutzen Sie einen HTML kompatiblen Viewer!";
$mail->MsgHTML($body);
$mail->AddAttachment("images/phpmailer.gif"); // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Nachricht gesendet!";
}
?>