[rt-users] mime outlook ms-tnef jumble (

Medi Montaseri medi at sc.prepass.com
Tue Apr 24 07:58:25 EDT 2001


I am using the following strip(1) perl program (home made) which looks like its

working with outlook, outlook express, and netscape. It only sends the first
part
which is what I want. Cuase sometimes, my users send excell and other MS stuff
along with their messages....check it out

Oh...I use this program in front of rt-mailgate.

|/home/rt/bin/strip |/home/rt/bin/rt-mailgate test correspond

For a Queue called 'test'

Anders Klint wrote:

> Dale Bewley wrote:
> > How are people dealing with mail from Outlook that just shows up in base64
> > in the ticket? Anyone come up with any clever work arounds? I need a
> > stopgap to keep the powers that be from getting a wandering eye.
>
> We use the "mimedecode" option in .fetchmailrc which works pretty well.
> That doesn't solve the problem with multipart mime, but as long as we
> get people to keep things in plain text it keeps us going. I suppose you
> could use stripmime if you need ta handle attachments.
>
> from .fetcmailrc:
> poll mail.got.gatespace.com proto pop3:
> user gssup password <PASSWORD> mimedecode mda "/apps/rt/bin/rt-mailgate
> support correspond"
> Hope this helps.
>
>         /Anders
>
> --
> ----------------------------------------
> Anders Klint             Gatespace AB
> Quality Assurance        +46 31 743 9821
>
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users

--
=======================================================================
Medi Montaseri, medi at prepass.com, 408-450-7114
Prepass Inc, IT/Operations, Software Eng.
=======================================================================


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20010424/6551c48e/attachment.htm>
-------------- next part --------------
#!/usr/bin/perl


$|++;
use MIME::Parser;

my $parser = MIME::Parser->new() || die "$!";

$parser->output_to_core (1) ; 
my $entity = $parser->parse( \*STDIN ) || die "$!";
my %Message;
GetHead( $entity, \%Message );
GetBody( $entity, \%Message );
SendMessage(\%Message);

undef($entity);

# --------------------- GetBody() ------------------
sub GetBody()
{
	my ($body, $href) = @_;

	my @Parts =  $entity->parts() ;
	if ( @Parts )
	{
		my $Top = $Parts[0];
		my ($type,$subtype) = split('/', $Top->mime_type()) ;
		my $Body = $Top->bodyhandle();
		my $IO = $Body->open("r") || die $!;
		$href->{'Msg'} .= $_ while ( $_ = $IO->getline() );
		$IO->close();

		#my $i = 1;
		#foreach my $Part ( @Parts )
		#{
			#my ($type,$subtype) = split('/', $Part->mime_type()) ;
			#next unless ( 	$type eq 'text' && 
					#$subtype =~ /plain|html/ );
			#my $Body = $Part->bodyhandle();
			#my $IO = $Body->open("r") || die $!;
			#$href->{'Msg'} .= $_ while ( $_ = $IO->getline() );
			#$IO->close();
			#last;
		#}
	}
	else
	{
		my ($type,$subtype) = split('/', $entity->head->mime_type()) ;
	
		if ( $type =~ /text/ && $subtype =~ /plain|html/ )
		{
			my $Body = $entity->bodyhandle();
			my $IO = $Body->open("r") || die $!;
			$href->{'Msg'} .= $_ while ( $_ = $IO->getline() );
			$IO->close();
		}
	}
	return(1);
}
# --------------------- GetHead() ------------------
sub GetHead()
{
	my ($entity, $href) = @_;

	my $head = $entity->head();
	my $From = $head->get('From');
	my $To = $head->get('To');
	my $ReplyTo = $head->get('Reply-To');
	my $Subject = $head->get('Subject');
	my $Date = $head->get('Date');
	my $CC = $head->get('CC');

	chop($From, $To, $ReplyTo, $Date, $Subject, $CC);

	$href->{'From'} = $From;
	$href->{'To'} = $To;
	$href->{'ReplyTo'} = $ReplyTo || $From;
	$href->{'Date'} = $Date;
	$href->{'Subject'} = $Subject;
	$href->{'CC'} = $CC;

	return(1);
}
# -------------------------- SendMessage() -----------------
sub SendMessage()
{
	my ($href) = @_;

	print "From: ", $href->{'From'}, "\n";
	print "Reply-To: ", $href->{'ReplyTo'}, "\n";
	print "To: ", $href->{'To'}, "\n";
	print "CC: ", $href->{'CC'}, "\n";
	print "Date: ", $href->{'Date'}, "\n";
	print "Subject: ", $href->{'Subject'}, "\n";
	print "\n";
	print $href->{'Msg'}, "\n";
	print "\n";
}
__END__
open(OUT, ">/tmp/m/mime");
print OUT while(<>);
close(OUT);
exit(0);


More information about the rt-users mailing list