I am trying to email a letter with many attachments to a client.

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(); }

In reply to Why is MIME::Lite not processing my attachments properly? by kleinbiker7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.