Mike Blezien wrote:
Read below

[snip]



Basically what we have is a piped forwarding script that when a "fake" email address, IE "[EMAIL PROTECTED]" is recieved it's piped to script:

#!/usr/bin/perl
##################################################################
use Mail::Audit;
use DBI;
use strict;
alarm(30);

#################################################################
# some other sub routines and MySQL database coding to extract
# the real email address and name.
# .... coding... continues....
#################################################################

my $mail         = Mail::Audit->new();
my $from         = $mail->from();
my $fwdto        = $mail->to();
my $subject      = $mail->subject();
my $body         = $mail->body();
my @mailbody     = defined($body) ? @{$body} : "No Message Received";

open(MAIL,"|$mailprog") or die $!;
print MAIL "To: \"$name\" <$sendto>\n";
print MAIL "From: $from\n";
print MAIL "Reply-to: $from\n";
print MAIL "Subject: $subject\n\n";
print MAIL [EMAIL PROTECTED];

  close(MAIL) or die $!;

exit();
######################################################################

Now the $fwdto is matched agaisnt the data in the database, and we extract the real address: $sendto and $name... The @mailbody array has the entire body of the email message. If it's a plain text message, the body of the email is fine and is displayed in the client's email reader without all those HTML characters, like below (Message Body content).. but if it's HTML formatted email message, then the body of the email contains all the garabage below. So what I am trying to do is either attempt to somehow extract the actual text content of the message or how to send it as the HTML formatted message properly so it's displayed correctly when received. If I where able to extract just the actual message content of the message content below, we would have something like this:


Ok I believe the problem is that you are stripping out portions of the header that you shouldn't be, specifically the portion that says that it is a multi-part message. So when your second reader gets the message it no longer states that the message is multipart. What through me is your use of Mail::Audit. You don't seem to be using any of its true functionality, only that you can read a message through it, which to my knowledge makes its use overkill since you could use one of the mime parsers directly.


Is there a particular reason why you not using the 'resend' method provided with Mail::Audit? This will allow the complete message to be intact and allow you to set the address to forward to. If you still insist on piping to $mailprog there is the 'pipe' method, again will allow the message to remain complete, but if $mailprog is just sendmail or the sort you are better off using a module's method to do this rather than piping directly to sendmail.


"Sent from [EMAIL PROTECTED] - [EMAIL PROTECTED]"

I'm sure there is a simplier way to do and I hope I'm making my self clear here.
:)

Definitely more clear. See if my comments help, if not fire off some more questions :-). This is why I (and others) are so adamant about not handling mail directly, amazing that such a complex beast can be made to seem so simple *most* of the time...


http://danconia.org


Message Body content:

 This is a multi-part message in MIME format.

  ------=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/plain;
  charset="US-ASCII"
  Content-Transfer-Encoding: 7bit

  *****Sent from [EMAIL PROTECTED] to [EMAIL PROTECTED]

  ------=_NextPart_000_0013_01C4419E.02807DF0
  Content-Type: text/html;
  charset="US-ASCII"
  Content-Transfer-Encoding: quoted-printable

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML><HEAD>  <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
 charset=3Dus-ascii">  <TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR></HEAD> <BODY>
<DIV><SPAN class=3D255234621-24052004><FONT face=3DArial>Sent from <A=20
href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</A> to =
<A=20
href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</A></FONT><=
/SPAN></DIV></BODY></HTML>


  ------=_NextPart_000_0013_01C4419E.02807DF0--

End of the message

TIA,
Mike




-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to