Im using dreamweaver. I want to have a "email us" page.

The person puts in there name,email..etc and it sends it to my mail box.

How do i do this? do i need to used a dynamic page?

Dreamweaver comes with email templates so or i have to do is fill the code in.
But i dont know what that is.

If anyones can help, please do.

thanks
please email me: everchange10@yahoo.co.uk

Recommended Answers

All 13 Replies

The basic Email form can probably be pulled from template example from DW like you mentioned, if not there are lots of examples on the web just google it. The portion you will have to cutomize is the form method and this depends on what scripting language you use and what your server supports again there are lots of examples o the web. One of the most popular is the php method.

When i create my site does it have to be a dynamic page?

I just have a normal html homepage.It has a few buttons, one of the 'contact' . i want people to fill in there email name,etc and send it to me via a "send" button.

Can anyone help

Thanks

your form page will be just like any other page except that it will have form tags

<form name="form1" id="form1" method="post" action="">
  Field Name: 
  <input name="field name" type="text" id="field name" />
</form>

the action=''''> is where you would need to use a langauge such as php which might look like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
	"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Contact Form</title>
<meta http-equiv="Content-Type" 
   content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
   if ($_SERVER['REQUEST_METHOD'] != 'POST'){
      $me = $_SERVER['PHP_SELF'];
?>
   <form name="form1" method="post"
         action="<?php echo $me;?>">
      <table border="0" cellspacing="0" cellpadding="2">
         <tr>
            <td>Name:</td>
            <td><input type="text" name="Name"></td>
         </tr>
         <tr>
            <td>Subject</td>
            <td><input type="text" name="Subject"></td>
         </tr>
         <tr>
            <td valign="top">Message:</td>
            <td><textarea name="MsgBody"></textarea></td>
         </tr>
         <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit"
               value="Send"></td>
         </tr>
      </table>
   </form>
<?php
   } else {
      error_reporting(0);
      $recipient = 'me@myaddress.com';
      $subject = stripslashes($_POST['Subject']);
      $from = stripslashes($_POST['Name']);
      $msg = "Message from: $from\n\n".stripslashes($_POST['MsgBody']);
      if (mail($recipient, $subject, $msg))
         echo nl2br("<b>Message Sent:</b>
         To: $recipient
         Subject: $subject
         Message:
         $msg");
      else
         echo "Message failed to send";
}
?>
</body>
</html>

You will need to check if you have access to a php server if not there are other methods that you can use. If all else fails you can send it via javascript, which is a dirty way to do it but will work.

thanks alot

I just found out that my server doesnt support php. I'm learning alot (it was cheap and now i know why)

so the next best way?

cheers

you should find out what they do support
asp
coldfusion
JSP
CGI

then I can try and walk you through how to use what you have available

you can more easily make an email form by simply typing the the action box of the form mailto:youremail@yourserver.com and in the enctyp feild text/plain but this can be an unreliable way and requires users to have an email client setup on their computer and working and if it fails it may fail invisibly. for more info go to http://www.macromedia.com/go/tn_14853

I had exactly the same problem. I used JMAIL with mine. this resolved the problem. This is where i got an example code: http://www.webwizguide.info/asp/tutorials/email_using_jmail_tutorial.asp. If i were you, go ahead and download the sample forms from here: http://download.webwizguide.info/asp_tutorials/JMail_web_based_email_tutorial_v1.0.zip. they contain 4 email samples and is very good for making jmail forms. Its fairly easy to pick up. The script will need you to put in your smtp server. This is a link which contains a link of many smtp servers: http://www.more-solutions.co.uk/support/email-smtp.html.

So there u go :cheesy:

good luck. If u need any more info, give me a bell (just remember, im not pro myself, but i recently had the same problem :P)

your form page will be just like any other page except that it will have form tags

<form name="form1" id="form1" method="post" action="">
  Field Name: 
  <input name="field name" type="text" id="field name" />
</form>

the action=''''> is where you would need to use a langauge such as php which might look like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
	"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Contact Form</title>
<meta http-equiv="Content-Type" 
   content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
   if ($_SERVER['REQUEST_METHOD'] != 'POST'){
      $me = $_SERVER['PHP_SELF'];
?>
   <form name="form1" method="post"
         action="<?php echo $me;?>">
      <table border="0" cellspacing="0" cellpadding="2">
         <tr>
            <td>Name:</td>
            <td><input type="text" name="Name"></td>
         </tr>
         <tr>
            <td>Subject</td>
            <td><input type="text" name="Subject"></td>
         </tr>
         <tr>
            <td valign="top">Message:</td>
            <td><textarea name="MsgBody"></textarea></td>
         </tr>
         <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit"
               value="Send"></td>
         </tr>
      </table>
   </form>
<?php
   } else {
      error_reporting(0);
      $recipient = 'me@myaddress.com';
      $subject = stripslashes($_POST['Subject']);
      $from = stripslashes($_POST['Name']);
      $msg = "Message from: $from\n\n".stripslashes($_POST['MsgBody']);
      if (mail($recipient, $subject, $msg))
         echo nl2br("<b>Message Sent:</b>
         To: $recipient
         Subject: $subject
         Message:
         $msg");
      else
         echo "Message failed to send";
}
?>
</body>
</html>

You will need to check if you have access to a php server if not there are other methods that you can use. If all else fails you can send it via javascript, which is a dirty way to do it but will work.

This was the best help. In a matter of a few minutes I had this email form up and running inside a table on my site. Thanks!

I do have a ? though. Is it possible to somehow encrypt or 'hide' the email address that receives the form? (So it does not get crawled and spammed)


Thanks again!

your form page will be just like any other page except that it will have form tags

<form name="form1" id="form1" method="post" action="">
  Field Name: 
  <input name="field name" type="text" id="field name" />
</form>

the action=''''> is where you would need to use a langauge such as php which might look like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
    "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Contact Form</title>
<meta http-equiv="Content-Type" 
   content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
   if ($_SERVER['REQUEST_METHOD'] != 'POST'){
      $me = $_SERVER['PHP_SELF'];
?>
   <form name="form1" method="post"
         action="<?php echo $me;?>">
      <table border="0" cellspacing="0" cellpadding="2">
         <tr>
            <td>Name:</td>
            <td><input type="text" name="Name"></td>
         </tr>
         <tr>
            <td>Subject</td>
            <td><input type="text" name="Subject"></td>
         </tr>
         <tr>
            <td valign="top">Message:</td>
            <td><textarea name="MsgBody"></textarea></td>
         </tr>
         <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit"
               value="Send"></td>
         </tr>
      </table>
   </form>
<?php
   } else {
      error_reporting(0);
      $recipient = 'me@myaddress.com';
      $subject = stripslashes($_POST['Subject']);
      $from = stripslashes($_POST['Name']);
      $msg = "Message from: $from\n\n".stripslashes($_POST['MsgBody']);
      if (mail($recipient, $subject, $msg))
         echo nl2br("<b>Message Sent:</b>
         To: $recipient
         Subject: $subject
         Message:
         $msg");
      else
         echo "Message failed to send";
}
?>
</body>
</html>

You will need to check if you have access to a php server if not there are other methods that you can use. If all else fails you can send it via javascript, which is a dirty way to do it but will work.

How would i go about adjusting the end section of script if i have put in an email address text box in the form.

Regards
Ashjenius

So this email form works perfectly that I quoted before a few posts up. I was wondering though how to make 1-2 fields a required fill in subject line. Nothing fancy like checking to make sure it's a valid email address, but just so they have to type something in the Name box the Email box.
If anyone would be willing to help out I'd be greatly appreciated. Here is the php script I'm using now but I have no idea who emails me since the email field is cgi-mailer@perfora.net.

Code works now fine, but I just want to add a required Name field and required email address field:

<html>
<head>
<title>Sandy Sanders Designs</title>
<meta name="keywords" content="Sandy Sanders,Sandy,graphic design,photography,osx,OSX,macintosh,mac,Gainesville,Florida,Maintosh,Mac">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="file://tabletext.css" rel="stylesheet" type="text/css"><link href="../tabletext.css" rel="stylesheet" type="text/css">
<script type="text/JavaScript">
<!--


function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
//-->
</script>
<style type="text/css">
<!--
.style2 {font-size: 10px}
#Layer1 {
position:absolute;
left:69px;
top:241px;
width:111px;
height:275px;
z-index:1;
}
body {
background-image: url(../images/background.jpg);
background-repeat: no-repeat;
}
.style3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
}
.style4 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif}
-->
</style>
<script type="text/javascript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="preloadImages();MM_preloadImages('../images/homeover.gif','../images/photoover.gif','../images/logosover.gif','../images/webdesignover.gif','../images/linksover.gif','../images/filesover.gif')">
<p>
<!-- ImageReady Slices (navbar.psd) -->
</p>
<p>&nbsp;</p>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><img src="../images/expandboxtop.gif" width="800" height="13"></td>
</tr>
<tr>
<td><table width="800" height="637" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="800" height="141" align="center" valign="top" bgcolor="#FFFFFF"><br>
<a href="../index.html"><img src="../images/sslogonew.gif" width="387" height="123" border="0"></a></td>
</tr>
<tr>
<td height="20" colspan="2" align="center" valign="top" bgcolor="#FFFFFF"><a href="../index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image7','','../images/homeover.gif',1)"></a><a href="photography.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image8','','../images/photoover.gif',1)"></a><a href="logos.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image9','','../images/logosover.gif',1)"></a><a href="webdesign.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image10','','../images/webdesignover.gif',1)"></a><a href="links.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image11','','../images/linksover.gif',1)"></a><a href="http://sandysandersdesigns.com/files/temp" target="_blank" onMouseOver="MM_swapImage('Image12','','../images/filesover.gif',1)" onMouseOut="MM_swapImgRestore()"></a><a href="../index.html"><img src="../images/newnavbar/nav1.jpg" width="102" height="61" border="0"></a><a href="photography.html"><img src="../images/newnavbar/nav2.jpg" width="99" height="61" border="0"></a><a href="pages/logos.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image10','','images/NavBar/3over.jpg',1)"></a><a href="logos.html"><img src="../images/newnavbar/nav3.jpg" width="89" height="61" border="0"></a><a href="webdesign.html"><img src="../images/newnavbar/nav4.jpg" width="53" height="61" border="0"></a><a href="links.html"><img src="../images/newnavbar/nav5.jpg" width="53" height="61" border="0"></a><a href="http://sandysandersdesigns.com/files/temp" target="_blank"><img src="../images/newnavbar/nav6.jpg" width="51" height="61" border="0"></a><a href="contact2.php"><img src="../images/newnavbar/nav7.jpg" width="114" height="61" border="0"></a><a href="contact.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image15','','../images/contactover.gif',1)"></a></td>
</tr>
<tr>
<td height="312" align="left" valign="top" bgcolor="#FFFFFF"><table width="131" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="70" height="49">&nbsp;</td>
<td width="61">&nbsp;</td>
</tr>
<tr>
<td height="58" align="center" valign="top"><a href="../fliesold.html"></a></td>
<td align="center" valign="top"><a href="orangelake1.html"></a></td>
</tr>
<tr>
<td height="19" align="center" valign="top" class="style2"><img src="../images/spacerbotmarg.gif" width="10" height="16"></td>
<td align="center" valign="top">&nbsp;</td>
</tr>
<tr>
<td height="58" align="center" valign="top"><a href="../fliesold.html"></a></td>
<td align="center" valign="top"><a href="orangelakeold.html"></a></td>
</tr>
<tr>
<td height="19" align="center" valign="top"><img src="../images/spacerbotmarg.gif" width="10" height="16"></td>
<td align="center" valign="top"></td>
</tr>
<tr>
<td height="57" align="center" valign="top"><a href="../fliesold.html"></a></td>
<td align="center" valign="top"><a href="orangelakeold.html"></a></td>
</tr>
<tr>
<td height="19" align="center" valign="top"><img src="../images/spacerbotmarg.gif" width="10" height="16"></td>
<td align="center" valign="top">&nbsp;</td>
</tr>
<tr>
<td height="59" align="center" valign="top"><a href="../fliesold.html"></a></td>
<td align="center" valign="top"><a href="orangelakeold.html"></a></td>
</tr>
<tr>
<td height="19" align="center" valign="top"><img src="../images/spacerbotmarg.gif" width="10" height="16"></td>
<td align="center" valign="top">&nbsp;</td>
</tr>
<tr>
<td height="59" align="center" valign="top"><a href="../fliesold.html"></a></td>
<td align="center" valign="top"><a href="orangelakeold.html"></a></td>
</tr>
<tr>
<td height="59" align="center" valign="top">&nbsp;</td>
<td align="center" valign="top">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<table width="275" height="35" border="0" cellpadding="1" cellspacing="0">
<tr>
<td width="298" height="35" align="left" valign="top"><img src="../images/buttons/contactinfo.gif" width="275" height="46"><br>
<a href="http://www.aboutus.org/SandysAndersDesigns.com" target="_blank" class="style4">about us.org</a> <br>
<br>
<?php
if ($_SERVER != 'POST'){
$me = $_SERVER;
?>
<form name="form1" method="post"
action="<?php echo $me;?>">
<table border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><span class="style5">Name:</span></td>
<td><input type="text" name="Name"></td>
</tr>
<tr>
<td class="style5">Subject:</td>
<td><input type="text" name="Subject"></td>
</tr>
<tr>


<td valign="top"><span class="style5">Message:</span></td>
<td><textarea name="MsgBody" cols="45" rows="17"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit"
value="Send"></td>
</tr>
</table>
</form>
<?php
} else {
error_reporting(0);
$recipient = 'fake@fakeemail.com';
$subject = stripslashes($_POST);
$from = stripslashes($_POST);
$msg = "Message from: $from\n\n".stripslashes($_POST);
if (mail($recipient, $subject, $msg))
echo nl2br("<b>Message Sent:</b>
To: $recipient
Subject: $subject
Message:
$msg");
else
echo "Message failed to send";
}
?>
</td>
</tr>
</table>
<p class="style4">&nbsp;</p></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="top"><img src="../images/expandboxfly7bott.gif" width="800" height="13"></td>
</tr>
</table>
<div align="center">
<span class="style3">Copyright &copy; 2006 Sandy Sanders</span>
</div>
<p align="center"><script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-754277-2";
urchinTracker();
</script>
</p>
</body>
</html>

The only thing I changed or posting this code on the web was my email address.
$recipient = 'fake@fakeemail.com'; hehehe

Again any help would be greatly appreciated!

p.s. I really hope I'm not spamming, but maybe in hopes that if I get a answer so will others :)

Cheers,

Great stuff, thanks!

- Vince
<URL SNIPPED>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.