Email system

Adamnet

New Member
Messages
56
Reaction score
0
Points
0
Hi
I am Adamnet Im looking for a support sender php that when ytou fill stuff out and you click send it sends to my email i had a thing like it before but it dident do like i wanted it to and you had to do more sutff
 

yokofigueroa

New Member
Messages
24
Reaction score
0
Points
0
mm....you had to do more stuff...?
oh...like these has nothing to do with design and stuff...
but
maybe u wanted a different look of m...sender...whatever...
me myself i kno how to make those in dreamweaver..it depens what kind of web u are developing,..like html php....or maybe u are using joomla...etc

If using dreamweaver..two tuorials
http://dreamweaver-demos.12wonderwebservices.com/How-to-create-a-form-in-Dreamweaver-MX.html
http://www.precisionweb.net/tutorials/custom_precision_dwmx_form.htm
ull have just to edit css

and maybe u will like also this
http://www.formlogix.com/
http://www.formsite.com/
 

Attachments

  • contactodreamweavr.JPG
    contactodreamweavr.JPG
    19.6 KB · Views: 23
Last edited:

FalseHope

Active Member
Messages
1,639
Reaction score
0
Points
36
Code:
<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ; 
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail( "someone@example.com", "Subject: $subject",
  $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

</body>
</html>
http://www.w3schools.com/php/php_mail.asp
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
Here's the code for the system I use:

contact.php =
PHP:
<?php
session_start();
$cansend=$HTTP_POST_VARS['cansend'];
if($cansend==1) {
$mailTo = "Your E-Mail Address";                # Put your E-mail Address here
$name=$HTTP_POST_VARS["name"];
$from=$HTTP_POST_VARS["email"];
$message=$HTTP_POST_VARS["message"];
$subject=$HTTP_POST_VARS["subject"];
$mailSubject="Website: $subject (From: $name)";  # Use this to customise the subject of the E-Mail.

$mailbody=$mailbody."\n".$message;
$headers = "From: $from";

if(mail($mailTo,$mailSubject,$mailbody,$headers))
{
$status="<div style='color:green;font-weight:bold;'>Your message has been sent successfully!<BR>I will get back to you as soon as possible.</div><BR><A href=index.php>Back to the homepage</A></center>";
}
else
{
$status="<center><div style='color:red;font-weight:bold;'>There was an error in sending your message!</div><BR><A href=index.php>Back to the homepage</A></center>";
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Contact the Admin</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</HEAD>
<BODY>
<SCRIPT type="text/javascript" language="javascript" src="email-check.js"></SCRIPT>
<TABLE cellpadding=5 cellspacing=2>
  <?php
		 if($status) {
		 ?>
  <TR>
    <TD colspan="2"><FONT size="+1"><B><?php echo $status;?></B></FONT></TD>
  </TR>
  <?php
		 }
		 else {
		?>
  <TR>
    <TD colspan="2"><P style="color:#FF0000">* All fields are required. </TD>
  </TR>
  <FORM method="post" name="contact" action="contact.php" onSubmit="return validate();">
    <TR>
      <TD align="right"><STRONG>Your Name: </STRONG></TD>
      <TD><INPUT name="name" type="text" maxlength="30"></TD>
    </TR>
    <TR>
      <TD align="right"><STRONG>Your E-mail: </STRONG></TD>
      <TD><INPUT name="email" type="text" maxlength="40"></TD>
    </TR>
    <TR>
      <TD align="right"><STRONG>Subject: </STRONG></TD>
      <TD><INPUT name="subject" type="text" maxlength="40"></TD>
    </TR>
    <TR>
      <TD align="right" valign="top"><STRONG>Message: </STRONG></TD>
      <TD><TEXTAREA name="message" cols=50 rows="10"></TEXTAREA></TD>
    </TR>
    <TR>
      <INPUT type="hidden" name="cansend" value="0">
      <TD>&nbsp;</TD>
      <TD>
<INPUT type='submit'>Send</INPUT>
<INPUT type='button' onClick="redirect();">Cancel</A>
        </TD>
    </TR>
  </FORM>
  <?php
	}
?>
</TABLE>
</BODY>
</HTML>

email-check.js =
Code:
function redirect()
{
window.location="URL to your homepage";
}
function validate()
{
	document.contact.cansend.value=1;
	return true;
}
function isEmail(emailstr)
{
	dotchar = emailstr.indexOf(".");
	atchar = emailstr.indexOf("@");
	dotlast = emailstr.lastIndexOf(".");
	spacechar = emailstr.indexOf(" ");
	len = emailstr.length;
	if( (dotchar == -1) || (atchar == -1) || (spacechar != -1) || (dotlast < atchar) || (dotlast == len - 1) )
	{
		return false;
	}
	else
	{
		return true;
	}
}
function trim(str)
{
ch = '';
for(i=0;i<str.length;i++)
{
	cha = str.charAt(i);
	if(cha != ' ')
	{
		ch = ch + cha;
	}
}
return ch;
}

Copy and Paste the code to the file names specified, then edit it to change your email address URL to you homepage etc. Then upload to your server. To test it go to contact.php in your browser fill in the form and click 'send'.

NOTE: If you haven't already you will need to upgrade to intermediate PHP for the mail() function to work.
 

kbjradmin

New Member
Messages
512
Reaction score
2
Points
0
This is a basic version of the system i use:

'form.php'
HTML:
<html>
<head>
<style>
textarea.message{
width: 300px;
height: 200px;
}
</style>
</head>
<body>
<form action="formpost.php" method="post" id="form">
<textarea id="message" value="" class="message"></textarea><br />
<input type="submit" value="Send Message" />
</form>
</body>
</html>


'formpost.php'
PHP:
<?php
$message = $_REQUEST['message'] ;
?>
<html>
<body>
/*html code*/
<?php
if(mail(email@host.com,"subject",$message)
{
echo "/*html code for success*/";
}
else
{
echo "/*html code for failure*/";
}
?>
</body>
</html>

its short and it works.

hope it helps!
 
Last edited:

Adamnet

New Member
Messages
56
Reaction score
0
Points
0
Parse error: syntax error, unexpected '@' in /home/adamnet/public_html/!ITrek/php/formpost.php on line 8

I added that and i got that

This is a basic version of the system i use:

'form.php'
HTML:
<html>
<head>
<style>
textarea.message{
width: 300px;
height: 200px;
}
</style>
</head>
<body>
<form action="formpost.php" method="post" id="form">
<textarea id="message" value="" class="message"></textarea><br />
<input type="submit" value="Send Message" />
</form>
</body>
</html>


'formpost.php'
PHP:
<?php
$message = $_REQUEST['message'] ;
?>
<html>
<body>
/*html code*/
<?php
if(mail(email@host.com,"subject",$message)
{
echo "/*html code for success*/";
}
else
{
echo "/*html code for failure*/";
}
?>
</body>
</html>

its short and it works.

hope it helps!
 

neelabh

New Member
Messages
7
Reaction score
0
Points
0
but is mail() supported by x10hosting??????:dunno::lockd::happysad:
 

TechAsh

Retired
Messages
5,853
Reaction score
7
Points
38
Yes.

If you read my previous post I have already mentioned this.
TechAsh said:
NOTE: If you haven't already you will need to upgrade to intermediate PHP for the mail() function to work.

You must upgrade you PHP to Intermediate to be able to use mail(). You can request an upgrade from the account panel (http://www.x10hosting.com/login).
 

VPmase

New Member
Messages
914
Reaction score
0
Points
0
You guys may want to be more secure with what you are being sent. If you don't want to be send images or links or HTML in general I'd use
PHP:
strip_tag($message);
 
Top