
   Main Page | Namespace List | Class Hierarchy | Class List | File List |
   Namespace Members | Class Members

                  WRITEMIME: C++ code to create MIME messages

   Author:
          email address: jean-francois.dockes@wanadoo.fr

Pointers

   Package home page: http://perso.wanadoo.fr/dockes/writemime/

   The detailed documentation is not included with the package, because it
   is much bigger than the code, thanks to doxygen... You will find it at
   the home page. Reading the present file, the exemple uses in
   wmmain.cpp, and maybe the comments in writemime.h is probably enough
   for simple needs.

   You will find a very nice set of MIME RFCs at:
   http://www.nacs.uci.edu/indiv/ehood/MIME/MIME.html

Motivation

   I needed a programmatic way to create E-mail messages with attachments,
   and I could not find any simple package with this functionality.

   Under Unix, executing an external mailer was not an option, because
   there is no uniform mailer interface.

   Extracting code from a program like pine or mutt would have been a
   possibility but they are not structured to let you do this easily, or
   are covered by the GPL.

   Being totally incompetent about MIME email and very slightly less so
   about C++ programming, I proceeded to write a (very basic) C++ MIME
   package.

   Note that, by default, writemime uses sendmail to actually send the
   formatted message. Other MTAs would surely work too. But this probably
   means that the module is not very useful under Windows, unless you have
   another way to speak SMTP.

   Writemime is free and covered by a BSD-like license, and you are free
   to use the code as you wish.

Overview

   Writemime will let you create two kinds of MIME messages:
     * Simple messages with a single body part
     * Multipart/mixed messages with multiple body parts

   Creating a message is trivially easy, and writemime will handle all
   encoding issues internally.

   Sample code to create and send a message:

   #include "writemime.h" using namespace WriteMime; void
   myCreateMessageWithNoErrorHandling() { CompositeMessage
   msg(Entity::MULTIPART, "mixed"); msg.setSubject("Mime multipart test
   message"); msg.addRecipient("me@myisp.com", "My R. Name");
   DiscreteEntity txt, attach; const char *body = "This is the message
   body text\nSecond line\r\n"; txt.setBody(body, strlen(body),
   Entity::TEXT); msg.addPart(&txt); attach.setBodyAttach("/usr/bin/yes",
   Entity::APPLICATION, "octet-stream"); msg.addPart(&attach);
   sendmail(&msg); }

   There is also a driver program (writemime) which will let you access
   most of the functionality from the unix command line. Type 'writemime
   -h' after compiling the package to get a hopefully helpful usage
   message.

   The driver provides a somewhat degraded way to access writemime
   functionality from a non-c++ program, or interactively..

Installation

   There is no installation procedure. Have a look at the Makefile, and
   compile the driver if you wish to use it. Else, just incorporate
   writemime.c++ and writemime.h in your program.

Things missing

   The following features are not currently supported, because I had no
   need for them, but I have no doubt that the module could be improved
   relatively easily if the need arises:

     * 'multipart/alternative' media type
     * 'multipart/related' media type
     * 'message' media type
     * header encoding (RFC2047)
     * Support for other types of Content-Disposition (currently always
       'attachment' except for a text part where writemime implicitely
       uses 'inline')
     * And undoubtedly plenty of other MIME bells and whistles.

   As far as I know the messages that the package creates are conformant
   to the RFCs, but the code is young and could be buggy.
     __________________________________________________________________


    Generated on Thu Jan 27 18:24:29 2005 for WriteMIME by doxygen 1.3.6
