# Send HTML Form per Mail

The sendform.php sends all sorts of HTML forms as mail.

## Structure of the form page

Immediately after body tag the sendform.php loaded:
<?PHP include "includes/forms/sendform.php"; ?>

### Forms are created using the following template:

To check the required fields the "form name" and "name of the required fields" separated by commas in the forms_onsubmit function. The Javascript for checking is automatically loaded. Forms are sent himself in the action attribute.
<form name="myform" method="post" action="<?PHP echo $_SERVER['REQUEST_URI']; ?>"
onsubmit="return forms_onsubmit('myform', 'Name,eMail');">
Name:* <input type="text" name="Name" />
eMail:* <input type="text" name="eMail" />
Kommentar: <textarea rows="5" name="Comment"></textarea>
<input type="hidden" value="1" name="sendto" />
<input type="submit" name="sendform" value="Send" />
</form>

It is sent each name and value of an input field, the name should therefore be chosen accordingly.

The text field someone has to be present, it is used as the sender field of shipping and the submit button must have the name "sendform" so that the mail will be sent. With the hidden field "sendto" can be sent to different recipients various forms.
Multiple options can be passed as an array. Example:
<input type="checkbox" name="Order[]" value="Catalog" />
<input type="checkbox" name="Order[]" value="Brochure" />

## Templates for mail delivery

In the directory /tpls are 2 templates: usermail.tpl for sending a confirmation email to the visitor and adminmail.tpl for the mail to website operator.
For each receiver ID from the "sendto" field can separate templates with the file name usermail[_ID].tpl or adminmail[_ID].tpl be created, eg usermail_2.tpl for ID 2. If there are no ID templates, the standard template will be used.

### Send pictures using the mail

In the config.php different images can be stored for mail delivery. The image files must be exist in the directory /imgs. The key of the variable $forms_mailimages is used as the key of the template variable $mailcontent. The keys are freely selectable.