skip to content

EZDetach API

Overview

EZDetach offers an API enabling custom scripts or applications to be invoked on every saved attachment. This API significantly simplifies the task of processing email attachments. No longer do you have deal with intricacies of interfacing with Outlook. You can develop a simple script, which acts on a single file and EZDetach will do the heavy lifting.

You can use EZDetach API for things like:

  • Automatic processing of incoming orders.
  • Importing email attachments into a content or document management system.
  • Print attachments.
  • Anything else that requires processing Outlook email attachments with a custom script.

API scripts can be run whether you invoke EZDetach manually or automatically (AutoSave, Scheduler, Rule).

See also

See How to run EZDetach in the User Guide for various ways to run EZDetach.

API Description

EZDetach passes two types of information to the scripts:

  1. File name of the saved attachment. It is passed as the first and only command line argument to the script.
  2. Additional information about the message, passed in environment variables.

Saved File Name

Saved file path is passed to your script as the first and only command line argument. The way you access that value depends on the language you use to develop the script. For example:

  • In a batch file - %1
  • In a VB Script - Wscript.Arguments(0)
  • In C# - args[0]
  • In Python - sys.argv[1]

If you are using a different language, refer to the programming manual.

Additional Arguments

The following environment variables are available.

Environment variable name Description
TH_SENDER_EMAIL_ADDRESS Message sender email address.
TH_SENDER_EMAIL_ADDRESS_SMTP Message sender SMTP email address.
TH_SENDER_NAME Message sender name.
TH_SUBJECT Message subject.
TH_NORMALIZED_SUBJECT Normalized message subject.
TH_HASATTACH “Y” if the message has attachments, “N” otherwise.
TH_MESSAGE_ID Message ID.
TH_FOLDER_PATH Folder name.
TH_MESSAGE_DATE Message received date.
TH_MESSAGE_TIME Message received time of day.

How to invoke your script

In order to have EZDetach invoke your script, simply enter the full path to the script in the Execute field of the Actions tab in the Edit Profile Window.

Note

If you use a script to write to a CSV file, please keep in mind that if you open the file in Excel, Excel will lock it and your script will not be able to write to it. Be sure to close Excel before running scripts.

Examples

Here are a few simple examples written in VB Script. You can use them as a starting point for your own development.

Save Word attachments in RTF format

This script saves Word documents, automatically converting them to RTF format.

doc2rtf.vbs

We’d love to hear from you

With the sample scripts above, we have just scratched the surface of what custom EZDetach scripts are able to do. If you have ideas for new scripts, or if you have developed a script and would like to share it with other EZDetach users, please let us know.