Sends an arbitrary email to the surfer, with optional attachment(s).
Here is a sample form specification which uses this function:
<FORM Method="post"
Action="/webc/runisa.dll?SV:DOS::SENDMAIL,Message.txt!Attach.zip!NextPage.htm!BadEmail.htm">
Please enter your Email: <INPUT Name="Email">
<INPUT Type="Hidden" Name="Subject" value="Desired message subject line">
<INPUT Type="Hidden" Name="FromEmail" value="emailtest@webcentre.co.nz">
<INPUT TYPE=Submit>
</FORM>
...where all the filenames after the SENDMAIL keyword can be any name you like, so long as they exist in a
path relative to your site's root directory.
- Message.txt contains the message to be sent to the surfer
- Attach.zip (optional) is one or more files (comma delimited) to attach to the message
- NextPage.htm is the page to be displayed after the mail is sent
- BadEmail.htm (optional) is the page to be displayed if they fail to type in a valid Email address -- if left blank,
a default error message is shown, with a link back to the FORM page
- The Email field is the surfer's email address, which they must enter
- The Subject hidden field is an optional subject line for the message -- if this is not set, it defaults to "Message from (sitename)"
- The FromEmail hidden field is an optional sender's email address -- if this is not set, it defaults to "administrator@(sitename)"
Notes:
- ALL punctuation (such as commas, colons) etc. is critical. If you want to leave a parameter empty, you must still put in the exclamation marks that would normally be there surrounding it.
- Any links to static pages, images or documents in NextPage.htm and BadEmail.htm must be absolute links (i.e. starting with a "/").
TEST SENDMAIL
Static result page, two attachments | | WebHub result page, no attachments |
|
|
|
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:
<FORM Method="post"
Action="%=cgiApp=%:DOS:%=session=%:SENDMAIL,Message.txt!Attach.zip!NextPage.htm!BadEmail.htm">
- You can also use WebHub macros like JUMPBACK in links on your STATIC page to revert to your own application
(instead of to 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:
%=SENDMAIL|sendmsg.txt!Attach.zip!!BadEmail=%
- 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 Attach 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.