Subject: copy imap body in the smtp message using smtpsend()

From: Emmanuel Sellier <[email-masked]>
Date: Thu, 9 Nov 2000 12:31:06 +0100

Hello,

I try to "forward" an imap message to an smtp mailbox.
* I have a body and envelope using :
	ENVELOPE *envelope;
	BODY * body;
	
	envelope=mail_fetchstructure(_stream, msgno, &body);

* then i call the smtpsend() methode passing both envelope and body
parameters and a new target addresss, replacing the <to> field in the
envelope.
	smtpsend(0, envelope, fwdMailbox, body);

* the original smtpsend was modified as  : 
int smtpsend(long debug, ENVELOPE *msg, char *to, BODY *body)
...
  msg->to=NULL;
  rfc822_parse_adrlist (&msg->to,to,curhst);
...
if (smtp_mail (smtp_stream,"MAIL", msg, body)) 
		TRACE("smtpsend(%s) : SMTP send ok", _name);
...

* the SMTP mail is sent but body is empty ??? does someone know what is
going wrong ?

Thanks a lot

Emmanuel Sellier
DATAMEDIA
www.irisa.com
Paris - France

-- 
------------------------------------------------------------------
 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, 9 Nov 2000 10:01:48 -0800 (PST)

> * the SMTP mail is sent but body is empty ??? does someone know what is

The BODY structure for mail sending is different from that of mail reading.
You can not use a BODY from mail_fetch_structure() to send a message.  Long
ago, it was intended that you could do so, but practical realities prevented
that from happening.

Unlike message reading, the body->contents field *is* used by the application
in message sending.  In message reading, body->contents is internal and not
for application use.

The next significant difference is in TYPEMESSAGE MIME parts, which in message
reading use body->nested.msg but in message sending use body->contents.  This
is *very* different.

Look at rfc822_encode_body_7bit() in rfc822.c to see how a sending BODY
structure is treated.  Also look at existing programs such as Pine.

It was a mistake to use the same structure with different interpretations of
the contents, for both; but I didn't realize that until it was too late and
programs started depending upon it.  Fixing it now would involve substantial
changes to existing applications.