Rename Attachments In Email

From MsgServerDocWiki

(Redirected from Rename Attach In Email)
Jump to: navigation, search

How can I rename an attachment in an email?

Sometimes it is desirable to rename attachments so that they can be 'neutered' e.g. rename .zip attachments which commonly contain virus payloads so that users cannot just automatically open and run the attachment. In this example *.zip files are renamed to *.zip.neutered for all emails destined for local accounts (the ims-ms channel).

  * NOTE: This was tested with Messaging Server 6.2 patch 118207-63
  * NOTE: Refer to the conversion channel documentation in the Messaging Server Admin Guide for further details on the commands used.

1. Enable the 'conversion' of the emails destined for the ims-ms channel.

Add the following to your <msg_base>/config/mappings file:

CHARSET-CONVERSION

! Convert all emails destined for local accounts
  IN-CHAN=*;OUT-CHAN=ims-ms;CONVERT Yes

2. Add a new mapping table which describe which attachments to rename.

Add the following to your <msg_base>/config/mappings file:

X-ATT-NAMES

   *.zip    $0.zip.neutered$Y

3. Add the appropriate conversion script to make the modifications to the name and filename MIME headers.

Add the following to your <msg_base>/config/conversions file (you may need to create this file if it doesn't already exist):

! Rewrite extension of files
in-channel=*; in-type=*; in-subtype=*;
   in-parameter-name-0=name; in-parameter-value-0=*; parameter-symbol-0=name;
   in-dparameter-name-0=filename; in-dparameter-value-0=*; dparameter-symbol-0=filename;
   out-parameter-name-0=name; out-parameter-value-0="'X-ATT-NAMES:\\'NAME\\''";
   out-dparameter-name-0=filename; out-dparameter-value-0="'X-ATT-NAMES:\\'FILENAME\\''"; relabel=1

Personal tools