Memory Leaks
============

Investigate and fix.
Add code to destroy values used for headers.

Threads
=======

Make sure that a threaded version of the library can be build.  Allow
multiple threads to access data structures if reasonable.  In particular
it would make sense for smtp_start_session() to be able to run in a
different thread from the rest of the program.  Having said that,
libESMTP should be safe in a multithreaded program so long as only one
thread accesses one session_t and its children at a time.  There are
no global variables so different threads could work on different
sessions simultaneously.

Headers
=======

When a header is set and is overriding a header in the message, make sure
a value set in the API is used only once.  For example the api defines
"X-My-Header: Hello World" but the message has two instances of X-My-Header:
The resulting message should have only one X-My-Header.

Implement Disposition-Notification-Options: not very urgent.

There are interactions between headers which are not yet properly handled.
E.g. if no To, but Cc *is* supplied.

Also Resent-*: headers interact with their counterparts.  Forwarding
messages might get confused concerning the Date, Resent-Date and originator
recipient fields.  Suspect that a special option to the header processing
is needed to convert various fields to resent- versions is needed.

Sender: is required of there are multiple values to From:

PPipelining
==========

Implement a non-blocking write in siobuf.c for use when PIPELINING is enabled.

Quoting
=======

In concatenate.c:  Add a version of concatentate() that takes an extra argument
which determines the quoting rules for the string being copied to the buffer.
At present, the application must be careful to supply only characters which are
legal when not quoted which is obviously v. unsatisfactory.

When supplying a phrase or a mailbox, different quoting conventions apply
do different syntatic elements of the phrase and maibox.  A better solution
might be to provide new APIs which quote and combines individual syntatic
elements into a single string which is then passed to the API.


Protocol Options
================

Add the ability Enable/Disable SMTP extensions.  Not sure about the value
of doing this, except maybe for coping with buggy servers.

Message Callbacks
=================

It strikes me that reading a message from a file might be a common enough
situation.  libESMTP should probably provide standard callback functions
that read the message from a FILE *, say in canonical format where the file
is a fully formatted RFC 822 message with CRLF terminated lines and one
which reads the RFC 822 message but where the Un*x \n is translated to CRLF
as the file is read.  A standard callback that reads the message from a
string may also be of use.

Status Handling
===============

Server status is recorded against messages and recipients during
the session.  However, this might take some time for many or long
messages.  An event callback mechanism is defined to allow the app
to handle status as it happens.  Implement it.  Same API can show
progress of the DATA/BDAT commands.

Status response to DATA/BDAT commands.  If a 2xx code is returned,
recipients with 2xx codes may be considered to be in receipt of the
message.  Otherwise, none of the recipients will receive the message.

At present, correct behaviour can only be expected for a single call
to smtp_start_session() for a given session structure.  Subsequent
calls should attempt to resend only messages which have failed to
recipients marked as having transient failure.

Enhanced Status Codes
=====================

Check conditions for enhanced status codes being supplied.
E.g. to RSET after RSET.  Intermediate response to DATA and intermediate
responses in general.

Autoconf
========

e.g. ifdefs to get right header files for different unices

*****************************************************************************

Summary of potential API additions/changes.  These are saved and done at
once to stop the libtool version number ramping up too rapidly.

RFC 821/RFC 822 quoting.
Default message callbacks.
