PopMonger Scripting Details
With a PopMonger Gold license, included with all paid versions of Mach5 Mailer, Popmonger gains built-in scripting capabilites to handle inbound email in complex ways.
You can script your inbound email handling with VBScript, JScript, or PHP. Please Note: All scripts can start and end with Mailer's scripting delimiters: <? and ?>. As of PopMonger 3, this is no longer necessary for VBScript and JScript scripts, but is generally conventional for PHP.
For each language, PopMonger provides a predefined context variable that makes a number of functions and properties conveniently available to you, as well as the entire contents of the email message. This information comes through the PopMonger object, which PopMonger initializes for you before executing your script.
- PopMonger can return various parts of the content of each email through three separate function calls: HeaderText, BodyText, and MessageText.
- HeaderText returns the entire message header as a string, with one header per line and a colon separating the name from the content.
- BodyText returns the entire message body as a string.
- MessageText returns the entire raw text of the email message including headers, html and text portions of the body, and any MIME encoded attachments.
- When a message bounces, you can get the original mailing address with the FailedAddress property.
- You can get the content of any specific header field with the HeaderField function. For example PopMonger->HeaderField("To") will return the recipient email address.
- You can get the number and types of sections in an email with the MimePartsCount and the MimePart functions. The MimePartsCount function returns the number of MIME sections in the email, and the MimePart function returns that section as a string.
- If your task includes field parsing with delimiters, you can access the field data and number of fields present through the Field function and FieldsCount property.
- You can also instruct PopMonger to send messages (see note). RedirectMessage will redirect the message to an alternative address or addresses, unaltered. ReplyWithText will send a text reply. SendMail will send an arbitrary message. The Extra Headers variable of SendMail shoud include one header per line.
- The SaveToFile function is a convenience available for you to save information during scripting to any file.
The class definitions for JScript, PHP, and VBScript are: