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 How to run EZDetach in the User Guide for various ways to run EZDetach.
EZDetach passes two types of information to the scripts:
- File name of the saved attachment. It is passed as the first and only command line argument to the script.
- 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 -
- In a VB Script -
- In C# -
- In Python -
If you are using a different language, refer to the programming manual.
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_NORMALIZED_SUBJECT||Normalized message subject.|
|TH_HASATTACH||“Y” if the message has attachments, “N” otherwise.|
|TH_MESSAGE_DATE||Message received date.|
|TH_MESSAGE_TIME||Message received time of day.|
How to invoke your script¶
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.
Here are a few simple examples written in VB Script. You can use them as a starting point for your own development.
Print image attachments (png, jpg, gif, bmp)¶
This script prints image attachments. PNG, JPG, GIF and BMP formats are supported.
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.