Jump to content

Help with php code


konrad_bilinski1

Recommended Posts

<p>Hey guys im posting my php code below. I am having trouble receiving emails from my contact page. Customer service told me it is because I do not have code for my smtp server. which is supposed to be "mailhub.myregisteredsite.com " . Does anyone know where I should put the smtp code? I am placing the php code I have below.<br>

here is the website if anyone is interested.<br>

www.momentsinmemories.com<br>

Help is much appreciated</p>

<p>Cheers,<br>

Konrad Bilinski</p>

<p><?php<br /> <br /> /* Set e-mail recipient */<br /> <br /> $myemail = "info@momentsinmemories.com";<br /> <br /> <br /> <br /> /* Check all form inputs using check_input function */<br /> <br /> $name = check_input($_POST['NAME'], "Enter your name");<br /> <br /> $email = check_input($_POST['EMAIL'], "Enter your email");<br /> <br /> $comments = check_input($_POST['MESSAGE'], "Enter a message");<br /> <br /> <br /> /* If e-mail is not valid show error message */<br /> <br /> if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))<br /> <br /> {<br /> <br /> show_error("E-mail address not valid");<br /> <br /> }<br /> <br /> $subject = "Feedback Message Form From $name";<br /> <br /> <br /> <br /> /* Let's prepare the message for the e-mail */<br /> <br /> $message = "Hello!<br /> A FeedBack Message form has been submitted by:<br /> <br /> Name: $name<br /> <br /> E-mail: $email<br /> <br /> Message:<br /> <br /> $comments<br /> <br /> <br /> <br /> End of message<br /> <br /> ";<br /> <br /> <br /> <br /> /* Send the message using mail() function */<br /> <br /> mail($myemail, $subject, $message);<br /> <br /> <br /> <br /> /* Redirect visitor to the thank you page */<br /> <br /> header('Location: thanks.html');<br /> <br /> exit();<br /> <br /> <br /> <br /> /* Functions we used */<br /> <br /> function check_input($data, $problem='')<br /> <br /> {<br /> <br /> $data = trim($data);<br /> <br /> $data = stripslashes($data);<br /> <br /> $data = htmlspecialchars($data);<br /> <br /> if ($problem && strlen($data) == 0)<br /> <br /> {<br /> <br /> show_error($problem);<br /> <br /> }<br /> <br /> return $data;<br /> <br /> }<br /> <br /> /* Functions we used */<br /> <br /> function check_input2($data, $problem='')<br /> <br /> {<br /> <br /> $data = trim($data);<br /> <br /> $data = stripslashes($data);<br /> <br /> $data = htmlspecialchars($data);<br /> <br /> if ($problem && $data == false)<br /> <br /> {<br /> <br /> show_error($problem);<br /> <br /> }<br /> <br /> return $data;<br /> <br /> }<br /> <br /> function show_error($myError)<br /> <br /> {<br /> <br /> ?><br /> <br /> <html><br /> <br /> <body><br /> <br /> <br /> <br /> <b>Please correct the following error:</b><br /><br /> <br /> <?php echo $myError; ?><br /> <br /> <br /> <br /> </body><br /> <br /> </html><br /> <br /> <?php<br /> <br /> exit();<br /> <br /> }<br /> <br /> ?></p>

Link to comment
Share on other sites

<p>your contact.x files live in the htdocs folder of the web server. The configuration files for the web server (and PHP) live in a different folder (usually 'etc' or 'conf') so you have to look for them.</p>

<p>create and run a file that has this in it which will give you information about the webserver's 'universe'....<br>

<? php<br>

phpinfo()<br>

?></p>

Link to comment
Share on other sites

<p>It's with their e-mail server. Your script is a fancier version of mine, but the "mail($variables) tells their server to send the message to your e-mail address. My script is simple:</p>

<p>$to ="insert e-mail address";<br>

$subject = $_POST["title"];<br>

$name = $_POST["name"];<br>

$message = $_POST["message"];<br>

$messagesent = "From: $name Message: $message";<br>

$from = $_POST["email"];<br>

$headers = "From: $from";<br>

mail($to,$subject,$messagesent,$headers);<br>

print " <meta http-equiv=\"refresh\" content=\"0;URL=contact3.html\"> ";<br>

?></p>

<p>The contact3.html is the Web page they get when it's sent. I use a simple form to format and send the e-mall.</p>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...