Sample Form | Reference | Miscellaneous

Posting Form Data to E-Mail
Post2EMail.php Basic Features

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.

Related Links 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:
<form name="sample" method="post" action=""> <input type="hidden" name="recipient" value=""> Your Name <input type="text" name="yourname" size="36" value=""><br> <input type="submit" value="Send"></form>
OK, that's not too useful, but it will work.

A More Useful Example

<form name="sample" method="post" action=""> <input type="hidden" name="recipient" value=""> <input type="hidden" name="responsePage" value=""> <input type="hidden" name="errorPage" value=""> <input type="hidden" name="fromUserFieldName" value="emailaddress"> <input type="hidden" name="required" value="lastname,firstname"> <input type="hidden" name="introLine" value="This individual would like to know more about your company."> <input type="hidden" name="echoBlanks" value="true"> <input type="hidden" name="sortOrder" value="firstname,lastname,emailaddress"> Last Name <input type="text" name="lastname" size="24" value=""><br> First Name <input type="text" name="firstname" size="18" value=""><br> E-Mail Address <input type="text" name="emailaddress" size="30" value=""> <input type="submit" value="Send"></form>


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):
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 successful submissions. Note that you may use your own pre-submission Javascript to build this URL with additional parameters which the response page can parse for a more customized response. The design of the actual page is up to you. If not specified, the generic LinkedResources thank you page is used, but you probably don't want that to happen.
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.
Be sure to investigate the advanced features as well.



Hosting information is available in our services section.

The source code for post2email.acgi and post2email.php is available.

Sample Form | Reference | Miscellaneous

LinkedResources thrives at the intersection of Web programming and MacOS X, including customized Applescripts and PHP Web applications such as XiTouch. It you are a Mac shop and would like to explore the significant cost savings and productivity improvements which may be realized thru workflow automation with these tools, feel free to contact me. Programming charges start at $95 per hour.

 © 1997-2022 Jeffrey W Baumann dba LinkedResources. All Rights Reserved. Last Updated December 28, 2021.