How to send email attachments with blocked file extensions 

Joined:
04/07/2009
Posts:
169

March 09, 2011 16:42:19    Last update: March 10, 2011 08:41:31
Email attachment blocking is a safety measure that can be a real pain in the *&^ when you have a legitimate need to send some file types that are considered "dangerous". Fortunately, as developers we have more than one weapon in our arsenal to defeat that feature. Here are some options I tried.
  1. Put the offending file in a zip - doesn't work for some services, Gmail is an example.
  2. Change file extension, e.g., from .exe to .ex_ or .doc. But this does not work if you are sending a WAR (Wab Application Archive) that contains hundreds of .js files.
  3. Base64 encode the zip, then gzip it. To restore:
    cat received.gz | gzip -d - | base64 -d - >original.zip
    

    This may still fail for some checkers, which looks inside the gzip file, detects the Base64 encoding and re-constructs the original zip file, then checks inside the zip for offending file extensions.
  4. Cut the Base64 encoded file into pieces with split, then create a zip out of the pieces. To restore:
    unzip received.zip
    cat received-piece* | base64 -d - >original.zip
    

    So far I haven't seen one that blocks this.
Share |
| Comment  | Tags