Formmail
Feature Overview Installing formmail will place a perl script in your website’s cgi directory. This script enables Note: In order for formmail.pl to work, it is required that you have a FormMail.conf file in your home directory. This file helps to prevent spam addressed to your domain, preserving your bandwidth for legitimate users of your site. In addition, it enables you to enhance your forms and provide shortcuts that not only simplify your forms, but also enable you to hide your email address from spiders and email harvesters.
Using formmail To use Formmail, you need to create a form on one of your web pages.
The form action line should be <FORM ACTION = "/cgi-bin/formmail.pl" METHOD = "POST">
formmail.pl will do all the programming work for you. You alter the behavior of Formmail by using hidden fields in your form. There is only one form field that you must have in your form for FormMail to work correctly. This is the recipient field.
Creating a configuration file Before you can use formmail, you will need to create a formmail configuration file. This can be done in one of two ways. The first method uses the File Manager in your Control Panel; the second uses ssh access to your domain. Either way will work equally well for this application. If you have any trouble creating your .conf file, please contact support for assistance.
Method One: File Manager
1 You will find the configuration file text at the bottom of this guide. Simply select the text with your mouse, right click, and choose copy.
2 Once the text is copied, go to your Control Panel Main Menu, and click the File Manager icon.
3 When the File Manager screen loads, type “.FormMail.conf” (without the quotes) in the text area to the left of Create/Edit file, then click Create/Edit file.
4 When the page loads, right click your mouse and select paste. (If the file is not empty, you already have a configuration file, and can skip this step.)
5 After you paste the text, change the size to 90 so that it will be easier for you to read and edit.
6 Scroll through the text of the configuration file, being sure to update the values to suit your needs. At the very least, you will need to enter your domain name (without the www.) in between the allow_mail_to lines, and put your email address in between the postmaster lines.
7 Once your changes have been made, click the Save button.
At this point, you can send email via forms in your html files to any email address set up on your domain. If you would like to send email to other addresses other than ones set up on your domain, simply add the email addresses in between the allow_mail_to lines of your configuration file. (There is more detailed information explaining this in the actual configuration file. Please read over it and if you have any questions, please contact support for assistance.)
Note: Although you will not be able to see your configuration file in the File Manager, it is there. Because it begins with a 'dot' (.), it is considered hidden. You can always access it simply by typing the name in the text area manually. This configuration file contains more detailed information concerning allow_mail_to.
Method Two: Command Line via SSH
This method may be considered a more advanced method because of the 'vi' editor. Its commands may be confusing to some individuals. If you have any problems with this method, please try the above method, or contact support for assistance.
1 You will need to enable SSH to your domain.
2 From the command prompt, type the following:
• cd /home/user (hit enter key) (Replace user with your domain's username)
• vi .FormMail.conf (the first dot "." indicates that this will be a hidden file and not visible from the File Manager).
3 Now, within the vi editor: If the file comes up with a blank screen,
• use the i key "i" to activate insert mode
• switch to the browser window (this screen)
• select-n-copy the Example .FormMail.conf at the end of this page.
• when copied, switch back to the shell screen and paste the copied text
• when the lines are pasted in, type Escape "Esc" and then colon 1 ":1" to go to the top of file (hit enter key)
4 Once at the top of the file, proceed to read the descriptions and become familiar with their purposes. When you come to postmaster and allow_mail_to , you will have to enter the values in between the two lines marking the boundaries of those values. The rest is optional, but very handy.
When you need to change the file, please refer to these 'vi' commands:
• Type i to get into insert mode.
• Type o to get into insert mode on the next line below your cursor.
• Type u to undo your last change. note: cannot be in insert mode.
• Type Esc to exit out of insert mode.
• Type :w to save the file.
• Type :wq to save and exit vi.
• To save your entries and exit the vi editor, do the following: Hit the Esc key, type :wq, then hit the Enter key.
The email addresses in the .FormMail.conf allow_mail_to section should match the email addresses in the value field (e.g): <input type=hidden name="recipient" value="username@hotmail.com,anothername@yahoo.com">
The form action line should be: <FORM ACTION = "http://domainname.ext/cgisys/ formmail.pl" METHOD = "POST">
The above is also true if you would like to use your own secure apache certificate for your forms. The only change is the FORM ACTION line. The http:// gets replaced with https://.
For example, the form action line for a domain specific certificate should be: <FORM ACTION= "https://domainname.ext/cgi-sys/formmail.pl" METHOD = "POST">
The above is also true if you would like to use a server wide secure apache certificate for your forms. The only change is the FORM ACTION line. The root domain name is required between the servername and the cgi-sys directory. For example, the form action line for server wide certificate should be: <FORM ACTION = "https://host.servername.ext/domainname/cgi-sys/formmail.pl" METHOD = "POST">
Required Form Fields
The only required field is the recpient field, which must have an email address as its value recipient
This form field allows you to specify where your form results will be mailed. Most likely you will want to configure this option as a hidden form field with a value equal to that of your email address.
Syntax:
<input type=hidden name="recipient" value="anyname@yourdomain.com,othername@yourdomain.com">