One line message in PHP

Can anyone tell me how to make a one field message in PHP
It is for the user to send their email address.
The multiple field messages are working fine.
This is my code

$comments = $_POST[‘email’];
$to = “jamesellisequities@gmailcom”;
$re = “New website email address feedback”;
$msg = $email;
$message = "From: " . $_POST[‘email’] . "
mail ( $to, $re, $msg );
This is the site Im working on.
Thank You for any advice.

You need to supply more code, you tell the body to be $msg, which is $email, but $email is undefined. You set the POST[‘email’] to comments.


$comments = $_POST['email'];
$to = "jamesellisequities@gmailcom";
$re = "New website email address feedback";
$msg = $comments;
$message = "From: " . $_POST['email'] . "\
mail ( $to, $re, $msg );

Thanks for that rguy84
But Im still getting the same error message:
“Warning: mail() [function.mail]: “sendmail_from” not set in php.ini or custom “From:” header missing in E:\Domains\j\\user\htdocs\feedback.php on line 16”

Oh see you never mentioned you were getting an error. From: is a special keyword, so it is thinking you are wanting to make $_POST[‘email’] be the sender. If you want to do that you will need to set the header.

You may also need the -f parameter too. Unless you’re using fakesendmail to connect to a google smtp server which ignores the -f and still inserts the accounts real email.

Time for some code dodgeinthshed!!

Paste the link on pastebin and paste link here. otherwise it’s kind of impossible to help you!

As you’re runnning PHP on Windows, you need to configure php.ini for sending e-mails, like the error message says:
“sendmail_from” not set in php.ini

Open your php.ini, find the section about sending mail, enter your SMTP server’s details and then save php.ini. Don’t forget to restart your webserver.

Thanks everyone, Ive solved the problem - Ive removed the offending email box!!!
Yes I know its a cop-out but if you look at the site, there is plenty of contact info anyway.
Plus it was my boss who told me to remove it as it was eating into my time - and I wasnt going to argue with him!!!