Does anyone know how I can set X-headers when using c-client's smtp functions?
The default rfc822_output() routine, called by the SMTP routines does not offer any means to write X-headers. There is a kludge by which you can do it, but it would be wrong to do it that way.
Instead, you need to write an rfc822out_t routine, which you arm by SET_RFC822OUTPUT, that does something like:
my_rfc822_output (char *t,ENVELOPE *env,BODY *body,soutr_t f,void *s,
long ok8bit)
{
if (ok8bit) rfc822_encode_body_8bit (env,body);
else rfc822_encode_body_7bit (env,body);
my_rfc822_header (t,env,body);
return (*f) (s,t) && (body ? rfc822_output_body (body,f,s) : T);
}The significant thing here is that you call a routine (which you also write) called my_rfc822_header() instead of the c-client rfc822_header().
rfc822_header() is really a sample routine, and not something that you should use in production; among other things, it doesn't check for buffer overflows. Your routine should do so. You do, however, need to look at rfc822_header() to see what sorts of things that you need to do in your routine.
Where are the X-headers, anyway? in the Envelope, Body?
X-headers are not registered headers, and thus do not appear in the ENVELOPE or the BODY. If you need them, you have to fetch them as header strings via mail_fetch_header() with the "lines" argument set to have the name(s) of the particular X-header fields that you want.
Another question: Where and when is the Message-Id generated in c-client?
It isn't. That is the job of your application when building the ENVELOPE structure.
If I send through the c-client smtp functions, how do I get the message-Id back to my code, so that I can store the message complete in the sent mailbox? (which I plan to do with the imap append function)
As noted above, your application sets env->message_id itself.
-- Mark --
http://staff.washington.edu/mrc Science does not emerge from voting, party politics, or public debate. Si vis pacem, para bellum. _______________________________________________ Imap-uw mailing list [email protected] https://mailman1.u.washington.edu/mailman/listinfo/imap-uw
