Reply to email problem
Posted: Tue May 06, 2008 12:07 pm
Hi there,
I've just built a contact form in my Flash website and have now got it working ok with my php script. The only problem is when I recieve an email from the form, the name that appears in my inbox is my hosting username and domain address. Is there anyway I can get the senders name or email address to appear there instead? Also when I hit reply to the email the reply address in the new email is my hosting address again! Can my script be altered so that I can reply to the sender's address without having to enter it in manually?
I know these are probably straight forward things to fix but I'm very new to PHP and am totally stumped!
Many thanks.
I've just built a contact form in my Flash website and have now got it working ok with my php script. The only problem is when I recieve an email from the form, the name that appears in my inbox is my hosting username and domain address. Is there anyway I can get the senders name or email address to appear there instead? Also when I hit reply to the email the reply address in the new email is my hosting address again! Can my script be altered so that I can reply to the sender's address without having to enter it in manually?
I know these are probably straight forward things to fix but I'm very new to PHP and am totally stumped!
Many thanks.
Code: Select all
<?php
//receiving variables from Flash, through REQUEST object, and storing them in local php variables
$title = $_REQUEST["title"];
$firstname = $_REQUEST["firstname"];
$surname = $_REQUEST["surname"];
$email = $_REQUEST["email"];
$phone = $_REQUEST["phone"];
$message = $_REQUEST["message"];
//filling information for email to be sent
$to = "me@myemail.com"; //destination email
$subject = "Website contact form"; //email subject
$full_msg = "Title: " . $title . "\n Firstname: " . $firstname . "\n Surname: " . $surname . "\n Email: " . $email . "\n Phone: " . $phone . "\n Message: " . $message; //email body
//line that actually sends an email
$ok= mail($to, $subject, $full_msg);
//based on results of mail function, sending failure or success message back to Flash
if($ok) {
echo("&serverResponse=Message was successfully sent.");
} else {
echo("&serverResponse=Sorry but the message could not be sent. Please try again.");
}
?>