Giter Site home page Giter Site logo

tinnef's Introduction

tinnef

Build Status Code Climate

This gem handles e-mail attachments packaged in the Microsoft "application/ms-tnef" MIME type. It's a Ruby wrapper for the tnef converter.

From Wikipedia: "Transport Neutral Encapsulation Format or TNEF is, despite the name, a proprietary E-mail attachment format used by Microsoft Outlook and Microsoft Exchange Server. An attached file with TNEF encoding is most often named winmail.dat or win.dat, and has a MIME type of Application/MS-TNEF."

Requirements

Ruby

Tested with Ruby >= 1.9.3

tnef

The binary of tnef is required in a current version, 1.4.6 is ok. Check if this tool already exists on your machine:

tnef --version

It doesn't exist? You can install it:

Mac OS X

Using Homebrew, just do:

brew install tnef

Using MacPorts, just do:

sudo ports install tnef

Linux

There are chances that this will work:

apt-get install tnef

Beware: On older Linux distribution, you will get a too old version of tnef, which does not work (e.g. 1.4.3 in Ubuntu Hardy), so you have to compile it by yourself. It's easy:

wget http://sourceforge.net/projects/tnef/files/tnef/v1.4.7/tnef-1.4.7.tar.gz/download
tar -xzvf tnef-1.4.7.tar.gz
cd tnef-1.4.7
./configure
make
make check
make install

Windows

What? I don't think this gem will work on Windows.

Installation

gem install tinnef

Usage

The gem defines the class TNEF with a class method to convert a given winmail.dat file. Use it with a block like in the following example:

require 'rubygems'
require 'tinnef'

content = File.new('winmail.dat').read
TNEF.convert(content, :command => '/opt/local/bin/tnef') do |temp_file|
  unpacked_content = temp_file.read
  unpacked_filename = File.basename(temp_file.path)

  File.open("/some/path/#{unpacked_filename}", 'w') do |new_file|
    new_file.write(unpacked_content)
  end
end

About the naming of this gem

"Tinnef" is a german slang word for "rubbish" or "trash". TNEF => TiNnEF => Tinnef - you know?

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

This code is based on the work by Peter Collingbourne, published as part of the alaveteli project. Thank you for sharing!

Copyright (c) 2010-2013 Georg Ledermann. See MIT-LICENSE for details.

tinnef's People

Contributors

alussos avatar evrone-opensource avatar ledermann avatar olleolleolle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.