Reputation: 13
I created a PHP POST mailing form a while ago and now i changed the website from http to https(ssl). The problem is that since then i get empty Mails. the normal body is there but the variables are empty. Can someone help me I can't find the problem...
Thanks in advance.
Here's the code:
<div class="title1">
<div><br /><?php
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "73BB Reservierung";
//Normale Felder
$vorname = $_POST['vorname'];
$nachname = $_POST['nachname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$amount = $_POST['amount'];
$date = $_POST['date'];
$time = $_POST['time'];
$nachricht = $_POST['nachricht'];
$body = urlencode('' . "\n" . '');
//Checkboxen
$email_message = "Reservierungsdetails:\n<br /> \n<br />";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Vorname: ".$vorname."<br />"."Nachname: ".$nachname."<br />"."Telefonnummer: ".$phone."<br />"."Personen: ".$amount."<br />"."Datum: ".$date."<br />"."Uhrzeit: ".$time."<br />"."Nachricht: ".$nachricht."<br /><br /><br />";
// create email headers
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = ''; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = ''; // SMTP username
$mail->Password = ''; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('', $nachname);
$mail->addAddress('', '73 Burger. Bar.'); // Add a recipient
$mail->addReplyTo($Email, 'eMail');
$mail->Subject = 'Reservierung via 73bb.de';
$mail->Body = $email_message;
$mail->AltBody = $email_message;
if(ctype_alpha($vorname)) { echo 'Es gab ein Fehler bei Ihrer Reservierung, bitte versuchen Sie es erneut.' ; }
else{
if(!$mail->send()) {
echo 'Die Nachricht konnte nicht gesendet werden, bitte versuchen Sie es erneut.';
echo 'Email Error: ' . $mail->ErrorInfo;
} else {
echo 'Die Reservierung wurde erfolgreich abgesendet!';
}
}
?></div></div>
Upvotes: 1
Views: 455
Reputation: 141
If you have http to https force redirection, It might be possible that the form being used post data to your http link. When received your rule redirect it to https and in this process the post data gets lost. Check the url in post data and make it https if it is not https
Upvotes: 2