Contents |
Preface
The message.cgi application is designed to be a flexible "mailer" CGI. It started out as Perl-based drop-in replacement for an AppleScript CGI written eons ago by a former webmaster, and has evolved from there to be quite the feature-rich beast.
WARNING
Most of the features described below are only available in message2.cgi if you're using the SUNY Potsdam CGI Server. message.cgi is kept very simple so as not to overexpose legacy form authors to otherwise unexpected behaviors.
Configuration options
All of these options need to be form fields in the submitting form. They can be hidden or any other kind of form element as long as they meet the stated requirements. Fields in the form other than these are simply sent as name = value pairs in the body of the e-mail.
The Basics
- Destination - The email address you want this e-mail to be sent to (yours)
- Sender - The email address you want this e-mail to appear to be sent from. You cannot necessarilly trust that a webform visitor will type in a real e-mail address, so it is recommended that you put something like "MY FORM USER" in this field.
- Subject - What do you want to appear in the subject header of the e-mail.
- Message - This is a small blurb that will be inserted into every message sent from the webform. You may want to remind yourself that the e-mail is coming from a webform.
- Bcc - The Blind Carbon Copy field is optional, but expects a comma-separated list of e-mail addresses to send a copy of this e-mail to.
- Redirect - The Redirect field is optional, but expects a URL. This will be the URL the user's browser is redirected to after submitting the form.
Requiring Fields
Our Webmistress had a need to make sure people were filling in certain fields. To this end the required field was added. It takes a comma-delimited list of fields to check and make sure contain something (no spaces between the fieldnames!!!).
Requiring Authentication
The fields auth_username and auth_password can be used to authenticate the submitter via LDAP. auth_username is passed on and auth_password is forgotten.
Suppressing the Refering Link
By default, the CGI displays on the confirmation page, and sends in the e-mail, a link to the refering formpage. This may not be desirable in some situations so setting suppress to anything will take care of this. Feature request by AIS for the HR Time Accounting page.
Auto-reply
Our Webmistress had another need to send submitters confirmation e-mail as well as the confirmation display screen. In order to maximize flexibility, this uses a file on the filesystem as a template. The field autoreply is set to the name of the template you're using (the path is fixed, to prevent people emailing the passwd file, etc.). You also must have a field called ar_to, the value of which is the name of the FIELD in the form where the "to" address for the e-mail is. Usable fields are:
- autoreply - The name of the template file to use. Also activates this feature.
- ar_to - The name of the form field to get the destination e-mail address from. If the field in question is blank, the feature is deactivated for this submission.
- ar_bcc - The name of the form field to get the destination BCC from.
- ar_from - Who the message should be from
- ar_subject - Subject of the e-mail
- ar_amountfields - A comma-delimited list of fields to scour for the amount of any transactions. These fields will be summed if there are multiple values! No spaces between fields just 'field1,field 2,field3'. Marked as $AMOUNT in the template.
- ar_greetname - The name of the FIELD to get a name to put in "Dear [whomever]," .. marked as $NAME in the template.
- ar_miscfieldN - Where N is a number 1 through 9, the named of the FIELD to bind to the variable $MISCN (where N is a number 1 through 9), to allow more options in reply templates.
File Uploads
A request from the library spawned this feature. If you add a file upload box to your form, you must name it file_upload, and you are currently limited to one upload box.
NOTE: You must use a multipart form (see below) if you're going to upload file data. If you don't do this, then the file will not actually upload, and only the name of the file will be visible.
<form method="post" action="http://whatever" enctype="multipart/form-data">