Re: removing one body part from a message

"Zaphod" <[email protected]> Sun, 13 Feb 2005 10:54:03 -0800
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <005d01c511fd$641eb7e0$55f07c44@mainrkclov3cts>
Sent: Saturday, February 12, 2005 3:37 PM
Subject: removing one body part from a message
If I create a reply to a message.

(I know there should be all kinds of error checking in this script and stuff,
it is all there I took it out to unclutter the script for this ,already long winded
example)


$Subject = $OrgMessage->get('Subject');
$OrgTo = ($OrgMessage->to)[0];
$OrgFrom = ($OrgMessage->from)[0];

my $BodyType = 'Mail::Message::Body::Lines';
my $signature = $BodyType->new(mime_type => 'text/plain', data => "This is the notice I added\n");
my $Message = $OrgMessage->reply(signature => $signature);

my $NewFromAddress = Mail::Address->new('', '[email protected]');
$Message->head->set('From',$NewFromAddress);
my $NewToAddress = Mail::Address->new('Zaphod', '[email protected]');
$Message->head->set('To',$NewToAddress);
my $NewFrom = ($Message->from)[0];
my $NewTo = ($Message->to)[0];
my $MsgId = $Message->head->get('message-id');
$MsgId =~ s/</<vm\.v1\.1/;
$Message->head->set('Message-Id' => $MsgId);
$Message->head->set('Subject' => $Subject);
$Message->send(via=>'sendmail');


How can I remove the first body part which says;
<snip>

[Your message is attached]
<snip>


What I wwould like is the original message included,
BUT I do NOT want the extra body part that it adds at the top'



<example message with all headers>

Return-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Sun, 13 Feb 2005 13:37:23 -0500
Received: from truckloa by orga.liquidweb.com with local (Exim 4.43)
 id 1D0OcV-000785-Ho
 for [email protected]; Sun, 13 Feb 2005 13:37:23 -0500
In-Reply-To: <004601c511fb$04604a50$55f07c44@mainrkclov3cts>
References: <004601c511fb$04604a50$55f07c44@mainrkclov3cts>
Content-Type: multipart/mixed; boundary="boundary-1108319845"
Content-Length: 2961
Lines: 96
Date: Sun, 13 Feb 2005 13:37:23 -0500
MIME-Version: 1.0
From: [email protected]
To: Zaphod <[email protected]>
Message-Id: <[email protected]>
Subject: This is a test

################################ I want to lose this part
--boundary-1108319845
Content-Type: text/plain
Content-Length: 28
Lines: 2
Content-Transfer-Encoding: 8bit

[Your message is attached]
############################and leave everything below
--boundary-1108319845
Content-Type: multipart/related;
 boundary="----=_NextPart_000_0042_01C511B7.F5799340"
Content-Length: 2521
Lines: 71

This is a multi-part message in MIME format.
------=_NextPart_000_0042_01C511B7.F5799340
Content-Type: multipart/alternative;
 boundary="----=_NextPart_001_0043_01C511B7.F5799340"
Content-Length: 951
Lines: 36

------=_NextPart_001_0043_01C511B7.F5799340
Content-Type: text/plain; charset="iso-8859-1"
Content-Length: 53
Lines: 5

this is a multipart message



with an inline image.
------=_NextPart_001_0043_01C511B7.F5799340
Content-Type: text/html; charset="iso-8859-1"
Content-Length: 609
Lines: 18

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>this is a multipart message</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><IMG alt="" hspace=0 
src="cid:004101c511fb$039a6240$55f07c44@mainrkclov3cts" align=baseline 
border=0></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>with an inline image.</FONT></DIV></BODY></HTML>
------=_NextPart_001_0043_01C511B7.F5799340--
------=_NextPart_000_0042_01C511B7.F5799340
Content-ID: <004101c511fb$039a6240$55f07c44@mainrkclov3cts>
Content-Type: image/gif;
 name="topbar.gif"
Content-Length: 1095
Lines: 15
Content-Transfer-Encoding: base64

R0lGODlhAwADAPcAAAAACP//////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////yH5BAEAAAAALAAAAAADAAMA
AAgHAAEIHDgwIAA7
------=_NextPart_000_0042_01C511B7.F5799340--


--boundary-1108319845
Content-Type: text/plain
Content-Length: 28
Lines: 1
Content-Transfer-Encoding: 8bit

This is the notice I added
--boundary-1108319845--

<end example message>


Zaphod