Testing for certain attachments


This tutorial will take look at the following principal object:
For an incoming email it should be examined whether specific files are available as an attachment.

Further actions are then performed based on the result from this test which evaluates if a pdf is attached to the email. Any other type of file format may be used a parameter instead. In the following example the title of the job in todo4teams is changed and informations are written concerning the identified e-mail attachment in the new title of the job.

The corresponding Java Script:

var hasPDF = false;
for(ai=0;ai<helper.attachments.length;ai++)
{
   var attachment = helper.attachments[ai];
   if(attachment.attachmentName.endsWith("pdf")){
     // do something...
     hasPDF=true;
    }
}
if(hasPDF){
 task.title="With PDF attachment: "+task.title;
}
     

Child Pages