This sends an email to the designated person containing the information the surfer entered on the current form.
FormMail also includes optional template message support for layout control.
Here is a sample form specification which uses this function:
Please tell me your:
Name <INPUT Name="SurferName"> (etc)
Email <INPUT Name="Email">
What do you think of it so far:
<TEXTAREA cols=30 Rows=5 Name="txtComments"></TEXTAREA>
<INPUT Type="Hidden" Name="TextAreas" value="txtComments">
<INPUT Type="Hidden" Name="Subject" value="Desired message subject line">
<INPUT Type="Hidden" Name="FromEmail" value="firstname.lastname@example.org">
...where the filenames after the FORMMAIL keyword can be any name you like, so long as they exist in a
path relative to your site's root directory.
- you@yourDomain -- the email address(es) to which the message should be sent -- comma delimited if more than one
- Message.txt (optional) -- template message to be sent. If not specified, a standard "dump" of form literals and the text areas listed in
Textareas will be sent. This dump will exclude form literals whose names start with an underscore.
- NextPage.htm is the page to be displayed after the mail is sent
- PGPID is your optional PGP encryption ID on the server -- omit unless PGP has been set up
- The Subject hidden field is an optional subject line for the message -- if this is not set, it defaults to "Message from (sitename)"
- The Textareas hidden field is an optional comma-delimited list of Textareas to send, assuming no Message.txt template has been specified
- ALL punctuation (such as commas, one or two colons) etc. is critical. If you want to leave a parameter empty, you must still
put in the colons that would normally be there surrounding it.
- If a "/L" is appended to Message.txt, all messages will be appended to the text file "FORMMAIL.LOG", which will be in the directory immediately above your document root directory. Regardless of the "/L" setting, any messages which could not be sent, for whatever reason, are also logged here.
You should look for, examine and delete this file from time to time...
- Any links to static pages, images or documents in NextPage.htm must be absolute links (i.e. starting with a "/").
Advanced notes for WebHub users:
- The examples above both preserve session information, even though one jumps to a static page
and the other to a dynamic one. Maintain the session ID when jumping by modifying the FORM ACTION as follows:
- You can also use WebHub macros like JUMPBACK in links on your STATIC page to revert to your own application
(instead of the service app) for subsequent handling.
- If you are using SendMail within your own WebHub application (via the SPIS services panel), just do a direct jump to a page like this:
<FORM METHOD=POST ACTION="%=ACTION|Result1=%">
where the Result1 page includes a macro similar to this:
- Each of the "!"-separated fields in the command can be the name of a WebHub literal or macro, which will be expanded.
In the case of the email address list, the entire list can be contained within a literal, and/or any element in it can be the name of a literal or macro.