How can I use rfc822_output() or one of the rfc822_* functions to convert the ENVELOPE and BODY into a string with out having to create a SMTP stream?
You need to define a soutr_t function that will add a null-terminated string to an output stream. To show you the concept, here is a sample
function (I don't advise actually doing this)
long mysoutr (void *stream,char *s)
{
return *s ? (long) strcat ((char *) stream,s) : LONGT;
}You can then do something like: rfc822_output (tmphdrbuf,env,body,mysoutr,(void *) msgbuf,NIL);
Note that tmphdrbuf has to be a large enough bigbuf to hold the entire header and msgbuf has to be a large enough bigbuf to hold the entire message. There's no protection against buffer overflow here.
To avoid buffer overflow, a more sophisticated application would probably write to a tmpfile instead, and define a rfc822out_t function as well so as to avoid the call to rfc822_header() (and do rfc822_header()'s work manually). Then do rfc822_encode_body_[78]bit() followed by rfc822_output_body().
-- Mark --
http://staff.washington.edu/mrc Science does not emerge from voting, party politics, or public debate. Si vis pacem, para bellum.
