PHP beginner could use some help here!
Well hell, I won't know unless i ask! Just stumbled across this place whilst trying to solve a problem with a PHP script so i figured i'd see if anyone can point me in the right direction.
I'm new to this, just finding my way to web design so bear with me if i sound like i ain't quite with it sometimes...it's because i'm not!
I'm trying to run a very basis PHP script for a feedback form but cannot seem to get it to work...
The form is at www.hovis21.sendmail.html
It is run on a windows server
I had tried the following as a script:
The form works but no email is generated. I have since found out from streamline.net who host the site that i need to alter the script to stop potential spam....they told me to:
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "email@example.com", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.hovis21.com/sendmail_thanks.html" );
"Use the PHP mail function and set the mail from using the following line of code.
When i try to replace
ini_set("sendmail_from", " firstname.lastname@example.org ");
with this I just get a parsing error...unsurprising since i'm not sure if i'm doing the right thing and i can't get a more detailed answer from streamline.
"From: $email" );
Anyway, just wondered if anyone out there could show me where i'm going wrong. I'd like to teach myself PHP scripting but it seems i've fallen at the first hurdle!
I always use this code
hope thats useful, will allow you to put HTML code in the email as well.
$subject = "You have new email";
$to = "email to send to";
$toname = "name of who your sending the mail to";
$body = "email message here";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$to.' '.$toname.' <'.$toname.'>' . "\r\n";
$headers .= 'From: Whoeveryouare <email@example.com>' . "\r\n";
mail($to, $subject, $body, $headers);
Ok, i think that makes sense...i'll try it and see. My only issue is i was trying not to alter the code too much, as i've just about understood how it works...the more i change the less i understand.
I wanted to get to grips with the basic form i have and then try to add to it...the problem seems to me to be the part that refers to the sender's email. If i can sort that then i think the rest will work. I'm hopeful anyway!!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)