HyFoMail
HyFoMail is a simple but flexible HTML Web Form to E-Mail script written in PHP.
Using HyFoMail
Create a webpage with a standard HTML form. Set the 'action' of the form to the URL of the HyFoMail URL. Set the 'method' of the form to POST - It MUST be POST, not GET.
Insert form elements (such as text fields, checkboxes, hidden fields, etc) and set the 'name' of each element to something relevant and unique (with no spaces). Each named field will become a variable available to be inserted into your template, discussed later. Note that HyFoMail doesn't support File fields yet, and using these may produce odd results. Other important considerations for this process are detailed later.
Don't forget to include a submit button. If doesn't matter what the 'name' of the button is, in fact, leaving the 'name' blank may be preferable so it does not get passed to HyFoMail as a variable.
Some settings may need to be passed to the script and this is done through specifically named hidden fields. Details of these settings are covered later.
Usually you will want to create an e-mail template to tell HyFoMail how to format the submitted information into an e-mail. If you don't create a template and tell HyFoMail to use it, it will use a standard e-mail layout containing all of the submitted information. This may be difficult to understand however, as it simply presents the variable names and their values.
The template may be a standard Windows or UNIX format text file. The final e-mail will be converted by HyFoMail into the UNIX format (only contains 'newline' at the end of each line instead of 'carriage return + newline' the Windows format has) otherwise lines in the resulting e-mail may be double-spaced.
Where you want the e-mail to contain submitted information, simply insert the 'name' you gave the corresponding form element. So, for example, if you put a couple of text fields in your form and named them 'firstName' and 'lastName', you could have a line such as "The sender's name is firstName lastName" into your template. There are also some standard variable you can put into your templates which are detailed later. Note that the variable names are CASE-SENSITIVE, so if you name a field 'firstName' you cannot put "firstname" into the template - it must be "firstName".
Some variables are used by HyFoMail to configure the way it works. These are no different to ordinary variables, but have specific names (detailed later). You can put these configuration variables into your e-mail template if you wish, as it will not stop HyFoMail from being able to use them.
Form Considerations
When creating the form and choosing the names to give all the fields there are a number for things to remember: -
Names must be unique (or blank, although data entered into a field with no name will not be available to the template) Radioboxes are the exception to this rule, of course, as only one radiobox of a many with the same name can be selected
Choose names that are relevant to the data of the field (such as 'userFirstName' or 'userPostCode')
Do not use names that are used by standard variables (detailed shortly)
Do not use names that are used by configuration variables (detailed shortly) unless you specifically want the configuration of HyFoMail to be affected by what the user enters
Avoid using names that may occur normally in the text of your e-mail templates (for example, if you have a field named 'name' and you have the line "The user's name is name" in your template, the resulting e-mail might contain "The user's Joe Bloggs is Joe Bloggs" which is obviously not right. 'userName' or 'contactName' might be more appropriate)
If you use checkboxes or radioboxes, set the checked 'value' to the text that you would like to appear in the final e-mail (for example, if you have a checkbox called 'over18' you might want to set 'value' to "User is over 18". Note that if the checkbox is not selected, the 'over18' variable will be empty, so there is no way of making the e-mail say "User is under 18" unless you use radioboxes)
If you want to send information to the script that is not entered by the user, use hidden value elements. This is the common way to set configuration variables
Standard Variables
Standard variables are automatically made available to every template (regardless of whether or not you include them in your form).
You should avoid using their names in your form as they will simply be overwritten by the standard values. This should be easy as they all begin "hfmStd_".
hfmStd_submitTime - this is the date and time the form was submitted by
the user in the format: "Thu, 13th June, 2002 - 1:08:59 am (GMT)".
It is currently always in GMT and does not adjust itself for British Summer
Time
hfmStd_submitBrowser - this is the raw version string sent by the browser, it will be something along the lines of: "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" for a computer running Microsoft Internet Explorer V5.5 on a Windows 98 machine"
hfmStd_host - this is the address of the server hosting HyFoMail. It will generally be along the lines of "server.domain.com" or it may be an IP address
hfmStd_referrer - this is the URL of the page that sent information to HyFoMail. This should be the URL of your HTML form. Some browsers don't send this information, but if they do, you can use it to check that the details came from your form and not some other potentially malicious form
hfmStd_userIP1 - this is the user's IP address as reported by the network. Under some circumstances (a badly configured proxy server, for example), this may not be the user's actual address but the address of a webcache or other proxy inbetween the user and the server. For this reason, an alternate IP address variable is provided...
hfmStd_userIP2 - this can sometimes be the user's correct IP address if the hfmUserIP1 is actually the IP of a badly configured proxy. Generally, if you want to include IP info in your template, you should include both IP1 and IP2 and if necessary, the recipient of the e-mail can perform reverse DNS lookups to see which is most likely to be the user's IP. The following variables are provided to make this easier...
hfmStd_userIP1RevDNS - this is simply URL to a web-based Reverse DNS Lookup of the user's IP (courtesy of DNSstuff.com). Clicking this link will generally open a webpage with details of the domain name associated with the IP address
hfmStd_userIP1Whois - this is a URL to a web-based IP WHOIS of the User's IP (again, courtesy of DNSstuff.com). Clicking this link will generally open a webpage with details of who the IP address is registered to. This should include contact details for reporting abuse
hfmStd_userIP2RevDNS & hfm_st_UserIP2Whois - as above but for the User's alternate IP address
Configuration Variables
Configuration variables set the way in which HyFoMail processes the submitted form and the way in which the e-mail is sent. Note that all configuration variables are optional.
Usually, these are set using hidden fields in the form, however, some, such as the e-mail address-related ones, may well be set using standard text fields, or even check/radioboxes.
hfmCfg_templateFile - this tells HyFoMail where to look for your e-mail
template file. If should be a full URL, including the protocal (eg. http://www.mtsite.com/template.txt).
If you do not provide a template then HyFoMail will construct an e-mail
containing all the available variables (including all standard and configuration
variables)
hfmCfg_emailTo - this tells HyFoMail where to send the resulting e-mail. You can specify multiple addresses by separating them with a comma. You can use complex addresses if you wish in the format: "Recipient Name <address@domain.com>" (no quotes) and you can mix these with simple addresses: "Name <add@dom.com>, simple@fubar.com, another@stuff.com, Complex Again <blah@blah.com>". If this variable is not set, the e-mail text will be output to the browser window and will not be sent as an e-mail at all. This is useful for testing your form and template.
hfmCfg_emailFrom - this tells HyFoMail what address to put in the From: box of the e-mail. This will allow the recipient to click the 'Reply' button to reply to a specific e-mail address. This might commonly be set through a text field as it will generally be the e-mail of the person submitting the form. If this variable is not provided, the e-mail will appear to be from "HyFoMail running on host.domain.com" (with the correct host information) with no e-mail address
hfmCfg_emailReplyTo - this tells HyFoMail to add a 'Reply-To' header to the e-mail which should tell the recipient's e-mail client to reply to a different address than the 'From' address if they click the 'Reply' button. This variable can be used instead of the hfmCfg_emailFrom variable to provide the e-mail receiver with the convenience of being able to click 'Reply' but still display HyFoMail as the sender of the e-mail (this can help avoid confusion). If either hfmCfg_emailFrom or hfmCfg_emailReplyTo are set, a small note will be added to the end of the e-mail (before the standard HyFoMail footer) informing the recipient that they can click their 'Reply' button
hfmCfg_emailSubject - this tells HyFoMail what the subject of the e-mail should be. If this is omitted, it will default to "Web Form Submission". Note that if an e-mail template is not provided and HyFoMail generates its own e-mail, it will use the e-mail subject text as a heading at the top of the e-mail as well
hfmCfg_successTitle - this tells HyFoMail what the title of the webpage displayed after a successful submission should be. If omitted, it defaults to "Form Submitted"
hfmCfg_successBody - this tell HyFoMail what the body of the webpage displayed after a successful submission should be. It can contain HTML. If omitted, it defaults to "<p>Your form has been submitted, thank you.</p>"
hfmCfg_successURL - this tells HyFoMail that after a successful submission it should redirect the user's browser to another webpage. If omitted, it will not redirect
hfmCfg_redirectDelay - this tells HyFoMail how long (in seconds) it should wait before redirecting the user's browser to the URL specified in hfmCfg_successURL. It is completely ignored if hfmCfg_successURL is not set. If omitted, it defaults to 5 seconds
User Options
Sorry, but like the Grolsch, Indigo Onion's User functions are just not ready yet.

