Instead of using formmail, or other public script, you can use PHP to generate emails if your host provides support for PHP scripting. This will allow you more flexibility in the format of the email that is generated, and will avoid the abuse associated with "formmail" scripts. You may also save the information entered in the form into a database table if desires.
Note: Your host must support PHP scripting.
This tutorial assumes you have a basic understanding of PHP and how it is used in NOF. To briefly refresh, PHP code begins and ends with <? ?> tags, and variables are delimited by pound signs before and after the variable. When the PHP interpreter sees these signs, it will evaluate these variables as the page is being constructed. Any other text will be sent to the browse as is.
To get started, you'll need to create 2 pages. The first page will contain your e-mail form, the second will contain the PHP code to e-mail. In this example, we will create a form that registers a user for the club newsletter.
Be sure to name your fields in your form with meaningful names, NOF defaults to "FormsEditField99" for it's own internal use. Your form should call the second page you created to do the processing.
On the second page, you'll need to create a text box. Then inside this box, you will put your PHP code.
The code inside the text box displays the necessary code to produce the e-mail.
When you have the e-mail set up as you would like, press OK to save it.
Remember to go back to Site View and rename the file with the .PHP extension so that the PHP interpreter on the host will recognize the page as a PHP page. The page with the form also should be name with the .PHP extension so that PHP can manage the form variables that are created and used.
Generate your pages. To see how it looks though, you will not be able to view it under Preview or Local Publish mode alone, you will either have to view it through a web server interface that is running PHP or on your host ("//localhost/newsletter.php").
On a local system, you will need to have PHP installed and running AND a Web Server package installed and running to do view this (such as IIS or Apache's web interpreter). If you do not have these running locally, you can also test by uploading to your host and then viewing the pages.
This tutorial was written by and is maintained by Tami Burke