PDA

View Full Version : sendmail.php files?


blanchard
02-11-2009, 09:59 PM
Hello all,
I bought webspace and set up a form to mail and it's working great.

Then I created a subdomain from my existing webspace, created a new site and I edited and dropped the sendmail.php on that space but I get a cannot find link error

edbr
02-12-2009, 12:44 AM
no reason it would not work in a sub domain, without seeing it i would say check the action path to your sendmail on the form

blanchard
02-13-2009, 01:59 PM
Here's the code for the sendmail.php


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>sendresults</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'thomasblanchard Results from Enquiry form';

// Your email address. This is where the form information will be sent.
$emailadd = 'info@thomasblanchard.co.uk';

// Where to redirect after form is processed.
$url = 'http://www.websites.agrivac.co.uk/thankyou.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
</body>
</html>

blanchard
02-13-2009, 02:00 PM
And here's the code for the Form


<form id="form1" name="form1" method="post" action="http://www.websites.agrivac.co.uk/sendresults.php">
<label>
<div align="right" class="formalignment">Name:
<input name="Name" type="text" id="Name" size="42" />
<br />
Email:
<input name="Email" type="text" id="Email" size="42" />
<br />
Telephone:
<input name="Telephone" type="text" id="Telephone" size="42" />
<br />
Enquiry:
<textarea name="Enquiry" id="Enquiry" cols="42" rows="6"></textarea>
<br />
<br />
<input type="submit" name="Submit" id="Submit" value="Submit" />
</div>
</label>
</form>

blanchard
02-13-2009, 02:02 PM
Now everything works apart from I don't receive an email.

I have tested the email out by sending one to myself and I received it instantly.

So I'm not too sure what not quite right, and ideas anybody?

edbr
02-14-2009, 03:02 AM
confused you received the email ? whats not working?

blanchard
02-14-2009, 03:12 AM
no i didn't recieve the email

edbr
02-14-2009, 04:06 AM
try action="sendresults.php (http://www.websites.agrivac.co.uk/sendresults.php)" instead of absolute (stabbing in the dark)
Is this the total sendmail? it doesnt have validation? and with recipients like hotmail , gmail etc check junk mail

blanchard
02-14-2009, 12:14 PM
ok cracked it,
It says on the trouble shooting page under sendresults on the hosts website that I have to use there email address for the form to mail as it configured slightly different to everybody elses or any other 3rd party emails, So I just set it up and it worked fine so i'll have to set up a email forward...cheers for all your help edbr

carolinawebdesign
03-11-2009, 04:03 PM
Who is your host? I am having a similar problem and this company is w. DirectNIC