PDA

View Full Version : no email arriving


debz22
03-31-2011, 06:31 PM
Hi, I have set up a php page and linked it to my contact form page and it all seems to go through on the the website but I am not receiving any emails.

Can anyone help?

Thanks

debz22
03-31-2011, 06:42 PM
This is my code...

<?php

$emailSubject = 'contactformprocess!';
$webMaster = 'name@yahoo.co.uk';

$email = $_POST['email'];
$name = $_POST['name'];
$comments = $_POST['comments'];

$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Comments: $comments <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);

$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://www.debbiesrecipesite.hostei.com/contact.html">
<style type="text/css">
<!--
body {
background-color: #06f;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #000;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">Your email will be answered as soon as possible!
You will return to the contact page in a few seconds !</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>

edbr
04-01-2011, 01:54 AM
$success = mail($webMaster, $emailSubject, $body,
$headers);
try just
mail($webMaster, $emailSubject, $body,
$headers);

davidj
04-01-2011, 03:08 PM
post the html form

davidj
04-01-2011, 03:14 PM
@ ed

mail() returns a boolean so assigning the return value (true or false) to a variable wont have any impact on the mail functionality.

NOTE: It returns true if it was successfully prepared for mailing but not if it mailed successfully

This is valid...
$success = mail($webMaster, $emailSubject, $body, $headers);Although in the above script is not being used so pointless to use it really

debz22
04-01-2011, 05:09 PM
html for the form

<form action="http://www.myaddress.com/contact.php" method="post" name="contact1" id="contact1">
<table width="500" border="0" cellpadding="5">
<tr>
<td>First name</td>
<td><input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td>Surname</td>
<td><input type="text" name="surname" id="surname" /></td>
</tr>
<tr>
<td>Email address</td>
<td><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td>Comments</td>
<td><textarea name="comments" id="comments" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td><input type="reset" name="reset" id="reset" value="Reset" /></td>
<td><input type="submit" name="submit" id="submit" value="Submit" /></td>
</tr>
</table>
</form>

edbr
04-02-2011, 01:15 AM
@ david thanks i just didnt see the point in it so i was grasping a bit. do you think its the absolute action thats stopping ?

<form action="http://www.myaddress.com/contact.php" method="post" name="contact1" id="contact1">

instead of <form action="contact.php" method="post" name="contact1" id="contact1">

Eliteoomph
04-03-2011, 11:35 PM
replace this

Name: $name <br>
Email: $email <br>
Comments: $comments <br>
EOD;

with this

name: $name
email: $email
comments: $comments
EOD;

and I am assuming your are replacing
name@yahoo.co.uk
with your actual email address...

davidj
04-04-2011, 08:11 AM
I steer away from using EOD as I'm not too keen on the practice

Try using standard variable assignments and strings