Trevor Local
asked on
PHP mailer form on Windows server
Hello
I have a website hosted on a Windows server. I need to get the contact form working, but I believe the code is missing the authentication parts, just not sure what I'm missing. Can someone help me out with that?
The current code I have is below:
I have a website hosted on a Windows server. I need to get the contact form working, but I believe the code is missing the authentication parts, just not sure what I'm missing. Can someone help me out with that?
The current code I have is below:
<?php
// list all vars to be expected from the movie
$vars = array("contact_name", "contact_email", "contact_message");
// and import them into the script
foreach($vars as $var)
if(isset($_POST[$var]))
$$var = $_POST[$var];
else
$$var = '';
// where to send it
// remove or configure one of the two code blocks
// otherwise your mail will be sent to johnnybegood@hotmail.com :)
// ***** or one fixed recipient ******
$recip = "info@mydomain.info";
//**** end fixed recipient *******
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=utf-8\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: photographer@domain.com";
// build up message
// this code for any multiline text fields
$message = str_replace("\r", "\n", $contact_message);
// info vars
$sender = $_SERVER[REMOTE_ADDR];
// you can rearrange this - just do not add or remove quotes
$mailbody = "Contact form send by:
Name: $contact_name
Email: $contact_email
Message:
$contact_message
-------
sender's ip: $sender";
mail($recip, "Contact form", $mailbody, $headers);
// and tell visitor
print "&status=sent_ok";
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER