Simple Email Form Question

can you guys help me with some simple questions with PHP… i dont understand it… I am new to PHP

i want to make a SQUEEZE PAGE; in it i need to make a PHP email form like this example:

http://www.ibdhost.com/contact/

where customers enter their information - it sends me an email

so i follow the procedure,
my question is:

  1. I do not have a domain server to test this on; so i download QUICKPHP; doesnt really work…; do i really need a domain server to test this?

  2. when the customer sends me the information, i SHOULD receive an email but from WHO? is it something like noreply@(mydomainname).com?

thanks in advance

You don’t have to have a domain name to test php’s mail().

You can use a free local web server like XAMPP. The headers in your mail() must include a From: header which needs to be a real email address on the mail server set in your SMTP parameter in your php.ini. You can set the SMTP parameter value using ini_set() in your php script if you don’t have access to your php.ini.

You also must have SMTP enabled on on your local or “real” web server for mail() to work.

Answering you question:

  1. no, download either Xampp or WampServer.
  2. read http://us3.php.net/manual/en/function.mail.php.
    basically a regurtitaion of what Kalon said

//of course sanitize everything that is received for user input
//sanitize $_POST
//setup to, message and subject
// make sure $_POST['email'] is only one email address
$email= $_POST['email'];
$additional_header = "From: $email\\r\
"
$t = mail($to, $subject, $message, $additional_header);
if($t){
echo 'sent';
}else{
echo 'failed';
}

If you try to send mail from your localhost, beware that it will get caught in every spam filter there is. Just be aware that you mailer may work but you may never get any mail.

Since sending email from localhost is considered spammy and in most cases will not even get into the spam box. Anyway thats what happened to me. In the good old days it used to work.