Read below

Wiggins d'Anconia wrote:
Please bottom post...

Mike Blezien wrote:

This is what comes in the body of the email message if it's not plain text message and need to pass the email with the right headers so it's displayed correctly when received:


Right, but the message itself is MIME and multipart. So I don't understand from your original question why you would be dropping either part? Shouldn't both parts continue on to their destination? I am still not understanding why you would need to know what the content type is of either part, since it is still just a single message. If the destination is MIME compliant it will read one, if not then it will read the preamble (and display it all), seems like you would still want them both? If you are trying to have it decide which then you would need to know apriori what the client can handle, and in the case of non-MIME you would drop everything not text, but that depends on knowing the client.

Which still gets back to the original point that only you can tell us if you want to drop the HTML or not.

I don't have specific sample code, can look into it but still trying to understand specifically what you are looking for. Maybe stepping back and looking at the problem as a whole, again, would help?

http://danconia.org


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:

"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.
:)

TIA,
Mike

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