Posting Form Data to E-Mail
LinkedResources has created an online tool for processing web form submissions and sending the information to you as a plain text email. The tool (post2email.php) has been developed and battle tested for over 5 years, and is flexible, powerful, and reliable (and faster than faxing). The advanced features provide spam protection, large form management, database integration, template based formatting, and FormMemory compatibility. If you would like LinkedResources to host this tool for you, click the hosting link below.
Post2EMail.php Basic Features
Comment: post2email.acgi, which ran natively on the classic MacOS, has reached end-of-life. It has been replaced with post2email.php, which runs natively on Unix systems, such as MacOSX and MacOSX Server. New features introduced with post2email.php are noted in green.
Bare Bones Example
Here is a very simple example of some HTML which utilizes the post2email.acgi/php scripts:
OK, that's not too useful, but it will work.
A More Useful Example
Here is a reference for the basic form fields which post2email.php recognizes (required fields are in red, new fields added with the PHP version are in green, and they are ordered from most highly recommended to least necessary):
Be sure to investigate the advanced features as well.
- the email address to which the form gets submitted. This is the only mandatory field. Only one address is allowed (spam-safe feature). If you must have the output sent to multiple addresses, talk to us.
- The (absolute) URL for unsuccessful submissions. Same notes apply as on responsePage.
- eg. "emailaddr". Since different forms may have been set up with different field names for the submitter's email address, this field allows you to specify that field name in the same place as the other parameters. If not specified, a generic bogus default is used.
- Comma separated list of required fields. The format is shown in the example code above.
- The subject to place on the email. If not specified, a field named "subject" is sought. If not found, a generic subject is manufactured.
- If "true", empty fields will be included in the email which gets sent. If anything else, only fields with values are returned. If not specified, this defaults to "true" unless suppressFieldnames is set to "true", in which case echoBlanks defaults to "false".
- Comma separated list of the fields to return in the email, in order. The format is shown in the example code above. If not specified, all non-admin fields (ie. the fields being discussed here) are returned in the order in which they appear on the form. If sortOrder is set to "_template", a template file will be used to create the email (see advanced features).
- If this field exists and is set to "true", the sender will receive a copy of the email generated by post2email.php (assuming a valid email address was entered). Due to a minor bug, you must actually use "helper_copy2self".
- Normally the field names are included with the respective values in the email which is produced. There may be times this is unwanted. If this field exists and is set to "true", the field names will not appear in the email. Note that this automatically sets echoBlanks to false (think about it).
- You asked for it, you got it. Now you can name your forms.
- If this field exists and is set to "true", then the redirect will not occur. Instead, you will see detailed output of the results of script execution. This is mainly for my benefit, but you may find it useful if your forms are misbehaving.
Hosting information is available in our services section.
The source code for post2email.acgi and post2email.php is available.
©1997-2010 Jeffrey W Baumann & LinkedResources, Inc. All Rights Reserved. Last Updated January 22, 2011.