Remove Images From Email

From MsgServerDocWiki

Jump to: navigation, search

How can I remove image or executable files from email and just deliver the text content?

UPDATE, 9/21/2010: This information has been moved to: http://wikis.sun.com/pages/viewpage.action?pageId=216501972. Refer to that page from now on.

Look at the conversion channel in the Sun Java System Messaging Server 6.3 Administration Guide. This allows you to replace the MIME contents of messages, that is, replace or remove image or executable files based on filename extensions

For example, to remove *.gif and *.exe files do the following:

  NOTE: This example was tested with Messaging Server 6.2 running patch 118207-63

1. Enable the conversion channel for emails being delivered locally (via the ims-ms channel)

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

CONVERSIONS
  
! Convert all emails coming in to local users from outside
  IN-CHAN=tcp_*;OUT-CHAN=ims-ms;CONVERT Yes

2. Write conversion script commands for each attachment type you want to remove.

Create the <msg_base>/config/conversions file and add the following:

! Delete *.gif attachments by filename
in-channel=*; in-type=*; in-subtype=*;
  in-dparameter-name-0=filename; in-dparameter-value-0=*.gif;
  DELETE=1

! Delete GIF attachments by media type
in-channel=*; in-type=image; in-subtype=gif;
  DELETE=1

! Delete *.exe attachments
in-channel=*; in-type=*; in-subtype=*;
  in-dparameter-name-0=filename; in-dparameter-value-0=*.exe;
  DELETE=1

These example entries show deletion based on file extension and on media type name. Several entries may be needed to catch all of the variants you want deleted.

3. Enable the rule.

Rebuild MTA configuration and restart using the following command:

cd <msg_base>/sbin
./imsimta cnbuild
./imsimta restart
Personal tools