The script below works but it goes straight to the junk folder only since i added the parts below to the form. (the form is in another file)
How do i stop it from going to the junk folder.
<?php
require_once "Mail.php";
$optional = $_POST['optional'];
$error = $_POST['error'];
$url = $_POST['url'];
$httpagent = $_POST['browser'];
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$from = "Web server <removed>";
$to = "Admin <removed>";
$subject = "Someone has submitted an error.";
$body = "Someone has submitted an error.\n".
"Error: $error\n".
"URL: $url\n".
"Web browser: $httpagent\n".
"Anything else you want to add?: $optional\n".
"IP: $ip\n";
$host = "removed";
$username = "removed";
$password = "removed";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
header('Location: thank-you.html');
}
?>