Jump to content
xisto Community
maddog39

Php Emailer/contact System An email or contact system for your site

Recommended Posts

Hello all,

 

Here is an easy Emailer or Contact system that allows visitors or members of your site to email you just by filling out a form. So here is what you need to do to set it up.

First open up a new page in your text editor and paste in the following code.

<?php$Name = $_POST['Name'];$Subject = $_POST['Subject'];$Email = $_POST['Email'];$Site = $_POST['Site']; $Message=$_POST['Message'];$align = $_POST['align'];$to = "$EmailTo";$subject = "$Subject";$body = "$Message\n\n\n$Site\nBy: $Name";$headers = "From: $Email\n";mail($to,$subject,$body,$headers);// After they've clicked "Send", this is where they are going... Change it to where you want them to go.header("Location: sent.htm");?>
then save this file as mailform.php

Next open up another new page in your text editor and paste in the following code.

<form action="mailform.php" method="post"><input type=hidden name=EmailTo value="You@mail.com"> <!-- // Change to your email address // -->Your Name: <input type=text name=Name><br>Subject: <input type=text name=Subject><br>Your Email: <input type=text name=Email><br>Your Site: <input type=text name=Site><br>Message: <br><textarea name=Message rows=6 cols=30></textarea><br><input type=submit value="Send"> <input type=reset value="Reset"></form>
then save that page as contact.htm

For the the last page, open up a new page in your text editor and paste in this code.

<p>Your message has been sent to the webmaster. You should recieve a reply shortly. </p><p><a href="index.php" target="_self">Go Back To Index?</a></p>
and then save that page as sent.htm

Upload all of the files to your server and your done.

 

*Also note that you can just take the code from 'contact.htm' and put it in another of your webpages on your site and do whatever you want with it but dont do anything with the other files or code unless you really know what your doing.

 

Comments are always appreciated and enjoy! :D:D

Share this post


Link to post
Share on other sites

does this work for anybody or do you have to have certain things enabled in php on your server?

57422[/snapback]

I think it will work on any server. Anyways, you can use some built-in scripts like form mailers in cPanel. I love your Avatar. Where did you get it?

Share this post


Link to post
Share on other sites

Thanks, i was looking for something like this for a long time. I embedded your code and it seems to work perfectly on my site.

Share this post


Link to post
Share on other sites

Yes this script is completley self contained and it doesnt need anything special. I havnt seen any mailer scripts in cPanel. Plus perl scripts are a pain in the butt. I like my script alot better. :angry:

Share this post


Link to post
Share on other sites

Wow, nice scripts, I too will use them when my hosting is renewed, I will have to try to find a nice purpose of course though, what kind of graphics are displayed with this, you should work on a version where you can add backrounds and stuff. Nice work! :angry:

Share this post


Link to post
Share on other sites

Theres nothing, just forms. But if I do-do something fancy it will be copyrighted and stuff. I will have restrictions to and it will be under the GPL lisence like my other PHP Programs. :angry:

Share this post


Link to post
Share on other sites

Theres nothing, just forms. But if I do-do something fancy it will be copyrighted and stuff. I will have restrictions to and it will be under the GPL lisence like my other PHP Programs. :angry:

58597[/snapback]

Please, do explain your code!

Share this post


Link to post
Share on other sites

at first you must html for and post it to php.php file

then copy paste this code to notepad and save php.php

<?php$MailToAddress = "Here"; // your email address$redirectURL = "ADD of your page next this page "; // the URL of the thank you page.# optional settings$MailSubject = "[mail subject for u]"; // the subject of the email$MailToCC = "here"; // CC (carbon copy) also send the email to this address (leave empty if you don't use it)# in the $MailToCC field you can have more then one e-mail address like "a@yoursite.com, b@yoursite.com, c@yoursite.com"# If you are asking for a name and an email address in your form, you can name the input fields "name" and "email".# If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.# You can use this scirpt to submit your forms or to receive orders by email.# If you have a multiple selection box or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" instead of just "name" # you must also add "multiple" at the end of the tag like this: <select name="myselectname[]" multiple> # you have to do the same with checkboxes# This script was written by George A. & Calin S. from Web4Future.com# There are no copyrights in the sent emails.# SPAMASSASSIN RATING: 0.4# DO NOT EDIT BELOW THIS LINE ==================================================================# ver. 1.5$w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://forums.xisto.com/no_longer_exists/ http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body>";if (count($_GET) >0) {	reset($_GET);	while(list($key, $val) = each($_GET)) {  $GLOBALS[$key] = $val;  if (is_array($val)) {   	$w4fMessage .= "<b>$key:</b> ";  	foreach ($val as $vala) {     $vala =stripslashes($vala);    $w4fMessage .= "$vala, ";  	}   	$w4fMessage .= "<br>";  }    else {  	$val = stripslashes($val);  	if (($key == "Submit") || ($key == "submit")) { }    	else {  if ($val == "") { $w4fMessage .= "$key: - <br>"; }    	else { $w4fMessage .= "<b>$key:</b> $val<br>"; }  	}  }	} // end while}//end ifelse {	reset($_POST);	while(list($key, $val) = each($_POST)) {  $GLOBALS[$key] = $val;  if (is_array($val)) {   	$w4fMessage .= "<b>$key:</b> ";  	foreach ($val as $vala) {     $vala =stripslashes($vala);    $w4fMessage .= "$vala, ";  	}   	$w4fMessage .= "<br>";  }    else {  	$val = stripslashes($val);  	if (($key == "Submit") || ($key == "submit")) { }    	else {  if ($val == "") { $w4fMessage .= "$key: - <br>"; }    	else { $w4fMessage .= "<b>$key:</b> $val<br>"; }  	}  }	} // end while	}//end else$w4fMessage = "<font face=verdana size=2>".$w4fMessage."</font></body></html>";if (!mail($MailToAddress, $MailSubject, $w4fMessage, "From: $name <$email>\r\nReply-To: $name <$email>\r\nMessage-ID: <". md5(rand()."".time()) ."@". ereg_replace("http://forums.xisto.com/no_longer_exists/; .">\r\nMIME-Version: 1.0\r\nX-Priority: 3\r\nX-Mailer: PHP/" . phpversion()."\r\nX-MimeOLE: Produced By Web4Future Easiest Form2Mail v1.5\r\nBCc: $MailToCC\r\nContent-Type: text/html; charset=ISO-8859-1\r\nContent-Transfer-Encoding: 8bit\r\n")) { echo "Please Write Information True";}else { header("Location: ".$redirectURL); }?>

Share this post


Link to post
Share on other sites

Thats overly long and completcated. Mine works fine and I dont see the point in doing what your saying. Just having it the way I have it is alot simpler to understand.

Share this post


Link to post
Share on other sites

What version of PHP is the person using? I think the $_GLOBALS function is old. I think the person behind the script is creating a PHP Script from PHP 3.

Share this post


Link to post
Share on other sites

Yeah im learning from a PHP 5 book and some of that stuff doesnt look familar to me. I think its PHP 3 also.

Share this post


Link to post
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...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.