Send posted form data via mail

You have hosted a website using ApplicGate. This web site has a form that posts data. Now this data should be sent via email to somebody.

This can be done easily via ApplicGate CGI as shown below.

Allow POST requests to the web page with keyword POST

e,g, POST:Postdata\*$|.txt
Then posts to the URL e.g. https://myServer/mypost will generate a file with a timestamp at the server within the subdirectory Postdata e.g. Postdata\mypost$2014-10-03_214910.3.txt

Define the processing of the received file with keyword STARTP

STARTP:”mypost:1KB!MailPost.exe!MailPost.txt MailPickup!30!M!mypostResponse.htm”

After data has been uploaded to the web page mypost (subdirectory of Postdata, maximum 1 Kbyte of data is allowed) the program MailPost.exe will be started (in this example it is located in the default directory of ApplicGate).

The start parameters are:

  • MailPost.txt … template to generate mail file
  • MailPickup … mail pickup directory of ApplicGate
  • Full qualified name of posted file, e.g. C:\ApplicGate\Postdata\mypost$2014-10-03_214910.3.txt
  • IP address of the source

Next parameters of STARTP:

30 … maximum allowed processing time in seconds
M … activate the mail thread of ApplicGate to send the mail
mypostResponse.htm … template for response message, the placeholder %output% will be replaced by the standard output of MailPost.exe

The program MailPost.exe is provided by ApplicGate:

This program reads post data and generates and stores RFC822 formatted files into the mail pickup folder.
Arg 0: name of mail template
Arg 1: Pickup folder
Arg 2: name of post data file
Arg 3: text (optional), for ApplicGate CGI: IP address of the sender

Notes on mail templates:
The template must start with a from: and a to: line and an optional subject: line
Data must be html formatted.
Filling out the template:
Any placeholder %name% will be replaced by the corresponding value of the post data.
%arg3% will be replaced by Arg 3 (if any).
%output% will be replaced by all name/value pairs of the post data.

Example of template:
subject: received a message %email%

<!doctype html><html><body>
IP address: %arg3%
</body></html> (C) V1.0.7495.29907 July 2020
Built for .NETFramework,Version=v4.8

Quick Contact Form