There are different methods for creating an email submission form.
Method 1 uses HTML code that can be fully created in Dreamweaver and uses the users own email settings to send the email.
Method 2 uses a 3rd party service to send the email (Google free contact form) or go to a site like http://www.mycontactform.com/
Method 3 uses server side scripting that sends the email via the server the web page is hosted on (below is a PHP example)
HTML Version:
To create an HTML mailto form
in Dreamweaver, follow these steps:
- Create the form - Insert > Form > Form
- Set the form properties:
- Action: "mailto: email@address.com"
- Method: "GET"
- Enctype: "text/plain"
- Create a submit button - Insert > Form > Button
This will give you a submission form that attempts to use the customer's web browser, email client, and/or OS to send the email.
PHP Version:
Here is a simple PHP script that will allow you to send email via a contact form submission. Be aware that you shouldn't use this form in your website unless you want people to use the form to send you spam messages. You can adapt the code here or Google "PHP contact form" for more examples.
- Create a new PHP document and call it whatever.php
- Switch to code view and copy and paste the code below
- Modify the code as needed
- Save the file and upload it to your server
- Test it out
<?
if($_REQUEST[message]){
//This checks if the form has been submitted or not
$to="YourEmailAddress@YourDomainName.Com";
// Modify the email address to be the email address you want to receive the email via your form.
$from=$_REQUEST[emailaddress];
// The from variable is set by the form field that was sent
$subject="Contact From Your Website";
// This is the subject of the message being sent to you from your form
$message=$from."- ".$_REQUEST[message];
// This is the message to be sent to you
mail($to,$subject,$message);
// This is the actual sending of the email using PHP's mail function http://us.php.net/manual/en/function.mail.php
$confirmto=$_REQUEST[emailaddress]; // The email address we'll send a confirmation to
$confirmsubject="Your Confirmation"; // Confirmation Email Subject
$confirmfrom="noreply@YourDomainName.Com"; // Your confirming emailer address
$confirmmessage="Thank you for your email, we will respond promptly."; // Message to send to confirm
//mail($confirmto,$confirmsubject,$confirmmessage); // Confirmation - uncomment this line to use it
//After the message is sent we will display a thank you message
?>
Thank you... Your message has been sent.
<? } else { // If the form has not been submitted show the form ?>
<form method="post" action="">
Email: <input type="text" name="emailaddress"><br>
Message: <br>
<textarea name="message"></textarea><br>
<input type="submit" value="send" />
</form>
<? } // Closing tag of the if and else statements ?>