Using a mail reply form on your web siteOften, you will want to have a page on your website that allows visitors to send you email messages without them having to use and configure a mail package. To do this, Precedence Internet provides the facility to convert an HTML form to an email message.
This service is only available to Precedence Internet customers with web-hosting accounts. All other access will be blockedThere are two stages to setting up a mail reply form: a) the HTML must be created to give the right information and b) you must configure the mail form software so that it knows where to send the mails to.
Writing the HTMLYour form needs to return the following variables
- name - The nameof the sender
- email - The email address of the sender
- subject - The subject of the message
- message - The message itself
The form needs to be submitted to http://www.ptlnet.com/mailback/ with method=POST
An example code segment is shown below (form components are highlighted):
<form method=POST action="http://www.ptlnet.com/mailback/"> <table width=70% align=center cellspacing=0> <tr bgcolor=#33cc99> <td align=center colspan=2><h1>Email us</h1></td> </tr> <tr bgcolor=#33ffcc> <td>Your name</td> <td><input type=text size=60 name=name></td> </tr> <tr bgcolor=#33ffcc> <td valign=top>Your email address</td> <td><input type=text size=60 name=email></td> </tr> <tr bgcolor=#33ffcc> <td valign=top>Your phone number</td> <td><input type=text size=60 name="field[Phone number]"></td> </tr> <tr bgcolor=#33ffcc> <td>Subject</td> <td><input type=text size=60 name=subject></td> </tr> <tr bgcolor=#33ffcc> <td valign=top>Message</td> <td><textarea name=message cols=60 rows=20 wrap=hard></textarea></td> </tr> <tr bgcolor=#33cc99> <td align=center colspan=2><input type=submit name=submit value="Send message"></td> </tr> </table> </form>
Configuring the behaviour of the mailback scriptA plain text file called mailconf.txt should be present in the same directory as the HTML form (e.g. if the URL is:
then the mailconf.txt file should be able to accessed as:
The format of the file is simply a number of separate lines which contain a setting name and value separated by an equals sign. Spaces at the start or end of lines are ignored. Valid settings are listed in the table below (all other options will be ignored):
|The email address to send all messages to. You may specify multiple addresses by separating them with commas.|
|success||A URL to go to if the mail is sent successfully (e.g. a page that says that the mail has been sent).|
|return||If a value for success is not defined, this is a URL to return to after the visitor has been notified about the successful sending (e.g. a main index page)|
|noemail||A URL to go to if the visitor does not specify an email address. If this is specified in the settings file, but no value is given (i.e. simply noemail=), then the message will still be sent. This could be useful if visitors to your site might not have email addresses and you have alternative methods of contacting them (e.g. your form asks for a phone number)|
|nomessage||A URL to go to if no message is typed. If this is specified in the settings file, but no value is given (i.e. simply nomessage=), then the message will still be sent. This could be useful to simply collect addresses, e.g. for a mailing list.|
|copysender||If set to "yes", then the sender will also get a copy of the mail sent to them|
|required||Set to a comma-separated list of field names that are required (e.g. if you have field[phone] in your phone and want to ensure that a value is entered, put required=phone in your configuration file.|
|bgcolor, fgcolour, link, font||These four options, if set, configure the background colour, text colour, link colour and font (respectively) on the error page returned if required fields aren't completed. They allow you to blend in with your site colour scheme.|
Points to note:
- All the form variables in the format field[description] (as described above) will be dealt with automatically, i.e. you do not need to add any extra options in you mailconf.txt file.
- All URLs that don't begin with
http://will be assumed to be relative to the page holding the form.
All values are optional except for email. Therefore a minimal file would be:
email@example.comHowever, you will probably want to personalise the mail handling by specifying your own pages to go to upon success or failure, e.g.
email = firstname.lastname@example.org success = http://www.mywebsite.com/talk/thanks.html noemail = noemail.html nomessage =