|
Thanks for the help guys. I have tried to put together the pieces of info, but it's not working for me. what I have now is the following:
<?php
RCPT TO: <enquiries@mywebsite.co.uk>
Mail From = $_REQUEST['email'] ;
$name = $_REQUEST['name'];
$comments = $_REQUEST['comments'] ;
if ((isset($_POST["name"])) && (isset($_POST["email"])) && (isset($_POST["comments"]))) { //if a filled textbox was submitted
> $fp = fsockopen("IP ADDRESS HERE", PORT NUMBER HERE, $errno, $errstr, 30);
> if (!$fp) {
> echo "$errstr ($errno)<br />\n";
> } else {
> $out = "GET / HTTP/1.1\r\n";
> $out .= "Host: IP ADDRESS HERE\r\n";
> $out .= "Connection: Close\r\n\r\n";
fputs ($fp, $name, $email, $comments); // send the data down the hole to the other end
>
> fwrite($fp, $out);
> while (!feof($fp)) {
> echo fgets($fp, 128);
> }
fclose ($fp); //close the socket
}
$success_page = 'contactsent.html'; //confirmation message page
//If there are NO mistakes in the field, user will redirect to this page
// Redirect to Home Page after message is sent
// SET $ctf_redirect_enable = 1; ON, $ctf_redirect_enable = 0; for OFF.
$ctf_redirect_enable = 1;
// Used for the delay timer once the message has been sent
$ctf_redirect_timeout = 5; // time in seconds to wait before loading another Web page
// Web page to send the user to after the time has expired
$ctf_redirect_url = 'index.html';
elseif (empty($name) || (empty($email) || empty($comments)) {
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
?>
<html>
<head><title>error</title></head>
<body>
<h1>Error</h1>
<p>
Oops, it appears you forgot to enter either your
name, email address or your comments. Please press the BACK
button in your browser and try again.
</p>
</body>
</html>
<?php
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
[... direct user to an error page and quit ...]
}
?>
The form is on an HTML page form code as follows:
<form id="contact_form" name="contact_form" action="sendmailTCP.php" method="Post">
<label>Name</label>
<br />
<input name="name" type="text" size="50" />
<label><br />
Email Address</label>
<br />
<input name="email" type="text" size="50" />
<label><br />
Comments</label>
<br />
<textarea name="comments" cols="50" rows="10" dir="ltr" lang="en" xml:lang="en"></textarea>
</label>
<br />
<input name="Submit" type="submit" value="Submit" />
</p>
</form>
The PHP code used to send to the right response pages but they don't even do that anymore and still no email in the inbox.
If anyone can see what is wrong with the code I'd be very very gratefull.
|