reply

Tags:    phpmailer

Hej! Jeg har knoklet med at sætte reply på min mail men det er ikke lykkes den sender godt nok mailen til min adresse uden error men den anvendte mail får ikke tekst dokumentet sendt. Kan du hjælpe mig så det virker. Hilsen Johannes Kjær.
[code lang="PHP"<?php
$your_email ='route@route66side.dk';// <<=== update to your email address

session_start();
$errors = '';
$name = '';
$user_emne = '';
$visitor_email = '';
$user_message = '';

if(isset($_POST['submit']))
{

$name = $_POST['name'];
$user_emne = $_POST['emne'];
$visitor_email = $_POST['email'];
$user_message = $_POST['message'];
///------------Do Validations-------------
if(empty($name)||empty($user_emne)||empty($visitor_email))
{
$errors .= "\n Navn, emne og e-mail skal udfyldes. ";
}
if(IsInjected($visitor_email))
{
$errors .= "\n Forkert e-mail værdi!";
}
if(empty($_SESSION['6_letters_code'] ) ||
strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
{
//Note: the captcha code is compared case insensitively.
//if you want case sensitive match, update the check above to
// strcmp()
$errors .= "\n Den captcha koden matcher ikke!";
}

if(empty($errors))
{
//send the email
$to = $your_email;
$subject="New form submission";
$from = $your_email;
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';

$body = "En besøgene $name har sendt en meddelse:\n".
"Name: $name\n".
"Emne: $emne".
"$user_emne\n".
"Email: $visitor_email \n".
"Message: \n ".
"$user_message\n".
"IP: $ip\n";

$headers = "From: $from \r\n";
$headers .= "Reply-To: $visitor_email/mailerror.txt \r\n";
mail($to, $subject, $body,$headers);
$headers = file_get_contents ("mailerror.txt");
header('Location: thank-you.html');
}
}

// Function to validate against any email injection attempts
function IsInjected($str)
{
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
{
return true;
}
else
{
return false;
}
}
?>][/code]



t