kleinbiker7 has asked for the wisdom of the Perl Monks concerning the following question:
The program does attach the files, and when I click on them, Netscape correctly shows the content.
The problem is then I click View Source the contents of ALL the files is listed.
So, suppose I am attaching 6 files to an email, each file is rendered ok when viewing in Netscape. However, when I view the source, I get the total contents of ALL SIX FILES.
Is there anyway I can stop this merging of files using MIMELITE? Here is the code that I am using.
Thank you!
Robert
sub EmailClient { my ($file, $dir, $list) = @_; my $msg; my $cover; my @list; my $data; my $bf; my $type; # 9/6/01 $today = `date '+%m/%d/%y'`; $today =~ s/\n//; $cover = "The email body message Thank you, Corporation, Inc."; ### Create a new multipart message: $msg = MIME::Lite->new( From =>'My address <webmaster@company.com>', To =>'robert@idi.net', Subject =>"Your Message", Type =>'text/plain', Data =>"$cover" ); ### Add parts (each "attach" has same arguments as "new") # Attach the HTML document if the email is not empty # Compress and attach the files # $list is a comma separated string of filenames like this: # file1,file2,file3,....fileN @list = split (/,/, $list); foreach $bf (@list) { undef $/; open (ATTACH, "$dir/$bf") || die "Cant open file $dir/$bf\n\n"; $data = <ATTACH>; close (ATTACH); # If file is an HTML file, set type to text/html # If it is an XML file, set type to text/plain if ($bf =~ /\.xml/i) { $type = 'text/plain'; } else { $type = 'text/html'; } $msg->attach ( Type =>"$type", Disposition =>'attach', Data =>"$data", Filename =>"$bf" ); } # Send the message $msg->send(); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Why is MIME::Lite not processing my attachments properly?
by idnopheq (Chaplain) on Sep 24, 2001 at 21:14 UTC | |
by kleinbiker7 (Sexton) on Sep 24, 2001 at 21:35 UTC | |
by idnopheq (Chaplain) on Sep 24, 2001 at 22:04 UTC | |
by baku (Scribe) on Sep 24, 2001 at 22:31 UTC | |
Re: Why is MIME::Lite not processing my attachments properly?
by Maclir (Curate) on Sep 25, 2001 at 07:37 UTC |