Team:Berlin/Contact
From 2014.igem.org
ValidateAddress($email)){
$emailStatus = -1;
}
}
if($subject == ""){
$subjectBoxEmptyAfterPost = 1;
$inputEmpty = 1;
}
if($message == ""){
$messageBoxEmptyAfterPost = 1;
$inputEmpty = 1;
}
// if there isn't an empty form box, continue checking, if the inputs are correct
if($inputEmpty == 0){
foreach( $_POST as $value ){
if( stripos($value,'Content-Type:') !== FALSE ){
echo "There was a problem with the information you entered.";
exit;
}
}
// for mail bots
if ($_POST["address"] != "") {
echo "Your form submission has an error.";
exit;
}
// creates and sends the mail by using phpmailer
require_once("inc/phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
if (!$mail->ValidateAddress($email)){
$emailStatus = -1;
}else{
$email_body = "Von " . $name . " mit der Email: " . $email . "
" . "
" . $message;
$mail->SetFrom($email, $name);
$address = "m.wessel@igem.berlin";
$mail->AddAddress($address, "Marius Wessel iGEM");
$mail->Subject = $subject;
$mail->MsgHTML($email_body);
if(!$mail->Send()) {
echo "There was a problem sending the email: " . $mail->ErrorInfo;
exit;
}
// if the email was sent successfully, link to the thank you page
header("Location: contact.php?status=thanks");
exit;
}
}
}
?>