Page 1 of 1
First code not working.
Posted: Mon Jan 17, 2011 8:48 am
by wayneio
Code: Select all
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "xxx", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.waynecovell.co.uk" );
?>
<form method="post" action="sendmail.php">
Email: <input name="email" type="text" /><br />
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
This is my HTML & PHP. As far as i can tell, it should work. It redirects to the right page after it has been submittedd, yet i get no email. Its hosted on
http://www.waynecovell.co.uk/form.html.
Any advice please?
Re: First code not working.
Posted: Mon Jan 17, 2011 10:30 am
by social_experiment
Try this
Code: Select all
<?php
$mailMessage = mail( "wayne.s.covell@gmail.com", "Feedback Form Results",
$message, "From: $email" );
if ($mailMessage) {
// redirect
}
else {
echo 'Email not sent';
}
?>
You are using $_POST in your form, use $_POST when accessing the variables.
Code: Select all
<?php
$email = $_POST['email'] ;
$message = $_POST['message'] ;
?>
Re: First code not working.
Posted: Mon Jan 17, 2011 1:06 pm
by wayneio
Hi, thanks for your advice, however when i tried it, i still recieved no email.
My hosting does say it supports PHP, and I assume that it would not even redirect if PHP was not enabled, so it can't be that problem
Re: First code not working.
Posted: Mon Jan 17, 2011 3:42 pm
by bigjoe11a
Hi! I didn't thing you would mind. I have a sample for you below. and This does work, and it has been tested...
Code: Select all
<?php
$toname = $_POST['name'];
$to = $_POST['email'];
$subject = "Reply from web site";
$linkurl = '<a href="Http://www.df-barracks.com">Delta Force Barracks</a>';
$my_message = <<<TEXT
<br> Hello $toname <br>
Welcome too my web site
<br>
Thanks <br />
Admin <br />
RE: Delta Force Barracks. <br />
<br />
<br> Follow this link to log in<br>
<br />
<a href='http://www.df-barracks.com">Delta Force Barracks</a>";
TEXT;
$from = "Your Name <Your email>";
$headers = "From : $from";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$my_message,$headers);
echo "Email sent<br />";
?>
Re: First code not working.
Posted: Tue Jan 18, 2011 12:31 am
by social_experiment
wayneio wrote:however when i tried it, i still recieved no email.
Here is a basic example (it's similar to what bigjoe11a posted) pasted
Code: Select all
<?php
$to = 'someone@domain.com';
$subject = 'hi';
$message = 'just a test message';
mail($to, $subject, $message) or echo 'Email wasnt sent';
?>
Also try with a different email address (if you haven't already)
Re: First code not working.
Posted: Mon Mar 07, 2011 7:19 am
by bigjoe11a
Did you ever get this to work. I never did here back from you,