Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-MIME CPAN distribution.

Report information
The Basics
Id: 45221
Status: resolved
Priority: 0/
Queue: Email-MIME

People
Owner: Nobody in particular
Requestors: marcogh [...] linux.it
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



there's a problem with the parts_set() function call: when the function is called with a one part message, it doesn't change that part but it justs change the content-type. i'll attach a file that shows the problem. marco.
Subject: bugreport.pl
#!/usr/bin/perl use strict; use Email::MIME::Modifier; my $email = Email::MIME->new( join "", <> ); my @stack; my $already_html=0; my $already_txt=0; # print $email->debug_structure; #remove_attachments($email); #&add_image_attachment($email,'logo.png'); #&add_image_attachment($email,'environment.png'); print "######\nBefore\n######\n" . $email->debug_structure; #&parts_walk($email); print "######\nAfter\n######\n" . $email->debug_structure; remove_attachments($email); #print $email->as_string; sub remove_attachments { my $email = shift; my @keep; foreach my $part ( $email->parts ) { push @keep, $part unless $part->header('Content-Disposition') =~ /^attachment/; remove_attachments($part) if $part->content_type =~ /^(?:multipart|message)/; &add_image_attachment($part,'logo.png'); } print "######\nIntra\n######\n" . @keep[0]->debug_structure; $email->parts_set( \@keep ); } sub file_read { my $filename = shift; my $buf; my $line; open(MYFILE,"<".$filename); binmode(MYFILE); while ($line = <MYFILE>){ $buf.=$line; } close(MYFILE); return $buf } sub add_image_attachment { my @temp; #my $buf; #my $line; my $email = shift; # shift(@_) my $filename = shift; my $newpart = Email::MIME->new(""); $newpart->encoding_set('base64'); $newpart->filename_set($filename); $newpart->name_set($filename); $newpart->content_type_set('image/png'); $newpart->disposition_set('attachment'); # $newpart->charset_set('ISO-8859-1'); # $buf = &file_read($filename); #open(LOGO,"<".$filename); #binmode(LOGO); #while ($line = <LOGO>){ # $buf.=$line; #} #close(LOGO); $newpart->header_set('Content-ID',''.$filename.'.06060507.09080005@turboden'); $newpart->body_set( &file_read($filename) ); # $newpart->header_set('Content-ID',''.$filename.'.06060507.09080005@turboden'); # $newpart->debug_structure; @temp = ($newpart); $email->parts_add( \@temp ); }
I looked at the code responsible for handling this behavior. It is really weird. What is it thinking?? I'll try to build a better test case and sort this out on my next run through. -- rjbs
I believe this is okay in the new version. I'm not sure, as this test seems to want input that is not provided..? If this is still no good, please provide more information at http://github.com/rjbs/Email-MIME/issues -- rjbs