Forum Moderators: coopster
we put the email address entered from the form into the $to variable
$to = $_POST['email'];
we then create a subject
$subject = "Order from www.example.com";
then we build our headers
$headers .= "From: MySite Orders <orders@example.com>\r\n";
$headers .= "Cc: orders@example.com\r\n";
$headers .= "Return-Path: orders@example.com\r\n";
$headers .= "Reply-To: orders@example.com\r\n";
now these are stripped headers from what I use and I put \r\n but I normally only use \n, again depends on too many things to squabble about. You may have problems getting the Return-Path to show properly but that could be a configuration thing as well. there are just too many things that effect email to explain them all.
The $to = $_POST['email'] - surely your emailing it to the person that enters their email into the form..thats what it looks like to me, and its from your email. Surely they should be the other way round?
$to = you@youremail.com
and
$headers .="From: $_POST['email']"
?
:)
now these are stripped headers from what I use and I put \r\n but I normally only use \n, again depends on too many things to squabble about
This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n).
Some content removed to save space
Note: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with » RFC 2822.
The $to = $_POST['email'] - surely your emailing it to the person that enters their email into the form..thats what it looks like to me, and its from your email. Surely they should be the other way round?
$to = you@youremail.com
and
$headers .="From: $_POST['email']"
$message = "Your order was successfully sent to www.example.com\n\n";
$message .= "First Name: " . $_POST['firstname'] . "\n";
$message .= "Last Name: " . $_POST['lastname'] . "\n";
$message .= "Email: " . $_POST['email'] . "\n";
$message .= "Product Requested: " . $_POST['product'] . "\n";
$message .= "Quantity: " . $_POST['qty'] . "\n\n";
$message .= "Thank you for using www.example.com\n\n";
A link to the original discussion we are talking about for the curious.
[webmasterworld.com...]
I guess that most people will use the mail function for what you were getting at, and they will be emailing the company the results of an order.
The example was just looking at another use of the mail function, if there is some other method of notifying the company that it has a new order.