mimetic is a free, MIT licensed, Email library (MIME) written in C++ designed to be easy to use and integrate but yet fast and efficient.
I'm a fan of the C++ Standard Library so mimetic has been built around
the standard lib. This means that you'll not find yet another string
class or list implementation and that you'll feel comfortable in using
this library from the very first time.
mimetic doesn't use exceptions but it heavily uses templates so a
mostly standard compliant C++ compiler is required. I developed it using
GCC 3.x and tested on most Unixes. When it comes to performance the stdlib is
important (and GCC's is not the fastest library around) so mimetic code
include some classes that are not strictly needed but are there just to improve
performance (for ex. the File class for memory mapped file access).
Most classes functionalities and behavior will be clear if you ever studied
MIME and its components; if you don't know anything about Internet messages
you'll probably want to read some RFCs to understand the topic and, therefore,
easily use the library whose names, whenever possible, overlap terms adopted
in the standard RFC documents. At the very least:
RFC 822,
RFC 2045 and
RFC 2046. A more complete
list can be found at the Earl Wood's MIME page.
Being a programmers I know that a code snippet is better then thousand words
:), so if you want you can jump to the Code Snippets section.
Latest release is 0.9.8
You can download it here: mimetic-0.9.8.tar.gz
-
Very easy to use
This was, from the beginning, one of the objectives of mimetic.
If you know the MIME standard you'll rarely need online documentation.
-
Full featured
Everything you expect to find in a MIME library is already into mimetic, if you'll not find it is because your requirements are probably insane :)
Oh well cryptography is not in the library yet, but it will some day.
-
Standard compliant
mimetic tries to follow current standards as closely as possible.
-
STL based
This could be a very big advantage if you know the STL and want to integrate
mimetic into your STL based project. You'll have same powerful concepts
and classes fully applicable to emails. If you don't know
the STL so this is a good opportunity to learn it! A very good reference (yet
freely readable) is the Dinkum C++ Library Reference.
-
Compile-time codec chains
Codec chains are template based so that codecs are chained together by the
compiler using inline functions whenever possible to speed up runtime
performance.
Creating a codec chain will sound very familiar if you know Unix pipes:
codec0 | codec1 | codec2 | ... | last_codec
Jump to a more complete example
-
Portable
I've personally tested it on Linux, {Open,Free,Net}BSD, Solaris, Mac OS X.
It uses Autotools to compile so porting on any Unix system should be easy.
Windows port has been done by Andreas Gruen but it's no loger maintained. You
can get last release of Visual Studio project files into mimetic/win32 directory.
If those are not enough please consider using Unix-style compiling on Windows
using Cygwin or MinGW.
-
More then 50 test functions, more then 2500 checks
cutee has been used for Unit Testing and there are a
lot of tests the run automatically every time someone compiles mimetic.
This doesn't mean that it's bug free but it helps.
-
Open source
Source code of the library, tests and examples are
bundled into the distribution package. All except codec code (that is
heavily template based) is very readable so if Documentation is not good
enough for you sources can be your primary reference.
-
HTML documentation
Library documentation is generated from source code by Doxygen. You can browse
it online of generate yourself for offline browsing (see
Documentation section).
You can read mimetic work-in-progress documentation online here.
The same HTML documentation can be auto-generated with
Doxygen:
# tar zxvf mimetic-x.y.z.tar.gz
# cd mimetic-x.y.z/doc
# make docs
|
mimetic-users mailing list is hosted by sourceforge: mimetic-users
#include <iostream>
#include <mimetic/mimetic.h>
using namespace std;
using namespace mimetic;
int main()
{
MimeEntity me;
me.header().from("me <[email protected]>");
me.header().to("you <[email protected]>");
me.header().subject("my first mimetic msg");
me.body().assign("hello there!");
cout << me << endl;
return 0;
}
|
#include <iostream>
#include <mimetic/mimetic.h>
using namespace std;
using namespace mimetic;
void printMimeStructure(MimeEntity* pMe, int tabcount = 0)
{
Header& h = pMe->header();
for(int c = tabcount; c > 0; --c)
cout << " ";
cout << h.contentType() << endl;
MimeEntityList& parts = pMe->body().parts();
MimeEntityList::iterator mbit = parts.begin(), meit = parts.end();
for(; mbit != meit; ++mbit)
printMimeStructure(*mbit, 1 + tabcount);
}
int main()
{
ios_base::sync_with_stdio(false);
istreambuf_iterator<char> bit(cin), eit;
MimeEntity me(bit,eit);
printMimeStructure(&me);
return 0;
}
|
|