Email Composed In Form

[Total: 0    Average: 0/5]

This allows the user to compose an email and then send it.

Head Code:

<script language="JavaScript">
<!--
  function sendMail() {
    if (document.forms[0].recipient.value == "") {
       alert("No recipient has been specified!");
       return false;
    }
    if (document.forms[0].message.value == "") {
       alert("No message has been entered!");
       return false;
    }
    if (document.forms[0].subject.value == "") {
       document.forms[0].subject.value = "No subject";
       return false;
    }
    // Construct a mailto: URL with all the details:
    document.forms[0].action = "mailto:" +
                    document.forms[0].recipient.value +
                    "?subject=" +
                    document.forms[0].subject.value;
    return true;
  }
//-->
</script>

Body Code:

<basefont size=3>
<h2>E-mail form<hr></h2>
Please enter a recipient, optional subject, and the body of
your message,
and then press the <b>send mail</b> button.<p>
<form method="post" enctype="text/plain">
<table border=0>
<tr>
<td align="right"><b>To:</b></td>
<td><input type="text" name="recipient" size=60>
</td>
</tr>
<tr>
<td align="right"><b>Subject:</b></td>
<td><input type="text" name="subject" size=60></td>
</tr>
<tr valign="top">
<td align="right">
</td>

<td><textarea name="message" rows=4 cols=60></textarea></td>
</tr>
</table>
<hr>
<input type="submit" value="Send mail" onClick="sendMail()">
</form>

Times Viewed: 4

Leave a Reply

Your email address will not be published. Required fields are marked *