Subject: MESSAGE/RFC822

From: Mike Trank <[email-masked]>
Date: Thu, 19 Oct 2000 21:40:26 -0600 (CST)

How do I put a whole message from an open mailbox as a message/rfc822 type
attachment?

I have a program that tries to contruct a message with the first part
text/plain and the second part a message/rfc822. This attachment I want to
be a copy of a message that I am extracting from an open mailbox.

BODY *msgbody;       // from a mesage in the mailbox
ENVELOPE *msgenv;   // also from a message inthe mailbox
MESSAGE msg;         // empty, so far.

msgpart[1]->body.type = TYPEMESSAGE;
msgpart[1]->body.subtype = "RFC822";
msgpart[1]->body.id = NIL;
msgpart[1]->body.description = "Forwarded Email Message";
msgpart[1]->body.nested.msg = &msg;
msgpart[1]->body.nested.msg->env = msgenv;
msgpart[1]->body.nested.msg->body = msgbody;
msgpart[1]->body.encoding = ????;
msgpart[1]->body.size.lines = ????;
msgpart[1]->body.size.bytes = ????;

The message that gets constructed and sent seems to have some correct mime
headers at least, since when I open it with pine, it shows part1
correctly, and that there is a part 2 type message/rfc822, and a part 2.1
with type text/plain but it has 0 bytes.

Is this because I have to set the size and/or encoding?

Also, "internal.txt" only talks about *env and *body in the MESSAGE
structure, but there is some other stuff in the structure. Do I have to
fil out any other of the member variables?

thanks.

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Thu, 19 Oct 2000 20:44:50 -0700 (PDT)

> How do I put a whole message from an open mailbox as a message/rfc822 type

Attach it the same way you attach a TEXT/PLAIN, only setting the type to
TYPEMESSAGE and the subtype to "RFC822".  Don't do anything with the
body.nested.msg stuff; that is for reading only, sending ignores it.

---

From: Mike Trank <[email-masked]>
Date: Thu, 19 Oct 2000 21:56:05 -0600 (CST)

errr, how then do I extract the entire text of the message as a char
string instead of the ENV and BODY structures?

do I do mail_fetchheader() and mail_fetchtext() and conactenate the two?

---

From: Mark Crispin <[email-masked]>
Date: Thu, 19 Oct 2000 20:59:25 -0700 (PDT)

> do I do mail_fetchheader() and mail_fetchtext() and conactenate the two?

Yes, that's one way of doing it.