The partoftype() command determines the file type of email attachments.
This command checks attachments against the contents of the file to see if they correspond to a particular file type. If this is the case, a defined action is performed. The contents of archive files can also be searched.
Structure of the command
partoftype('type','action','check_archive');
Return value
positive |
If the specified MIME type was found in the attachment(s) of the email |
negative |
If no attachment of the MIME type specified was found |
Parameters
type
For more information about the type parameter, see section List Of MIME Types. Here, you can insert file types separated by commas as well as entire type groups.
The lists List of file types and List of file groups used before 7.4.2 are still supported for compatibility reasons but will no longer be updated.
It is also possible to define exceptions by prefixing them with an exclamation mark "!". Exceptions must always be at the beginning of the parameter.
action
Possible values
•info |
provides the result for the following commands |
•delete |
additionally removes the corresponding file attachment from the email |
Default setting is info |
check_archive
If you activate this parameter, the specified MIME type is also searched for in archive files.
If the MIME type is found within an archive and the action "delete", is also set, only the corresponding file is removed from the archive. The archive itself is retained.
Possible values:
•true, yes or 1
•false, no or 0
The default setting is 0
Example 1
Line |
Code |
---|---|
01 |
partoftype('!zip,application/msword,application/pdf,video','delete','true'); |
Explanation
In this example, an email is checked for the presence of file attachments of the types 'application/msword' and 'application/pdf'' as well as the group "video", with the exception of files with the file extension "zip". If a file attachment of a named MIME type or a MIME type group is found, it will be removed from the email. If the email contains an archive file as an attachment, it will also be searched, and any affected files will be removed.