Hi, I am able to send single attachment but not multiple attachments. Can Any one help? The following code only attached one file from the directory

my $msg = MIME::Lite->new ( From => $msgFrom, To => $msgTo, Subject => $msgSubject, Type =>'multipart/alternative', ) or die "Error creating multipart container: $!\n"; # Create the HTML part my $html_part = MIME::Lite::->new( 'Type' => 'multipart/related', ); $html_part->attach( 'Type' => 'text/html', 'Data' => qq{ <body> <p>hello</p> </body> }, ); my $att_part; my @files = glob("F:/folder/*"); $att_part = MIME::Lite::->new( 'Type' => 'application/octet-stream', 'Encoding' => 'base64', 'Path' => shift @files, ); $msg->attach($html_part); $msg->attach($att_part); my $email = $msg->as_string(); my $smtp = Net::SMTP_auth->new($smtphost, Port=>$smtpport) or die "Can +'t connect"; $smtp->mail($msgFrom) or die "Error:".$smtp->message(); $smtp->recipient($msgTo) or die "Error:".$smtp->message(); $smtp->data() or die "Error:".$smtp->message(); $smtp->datasend($email) or die "Error:".$smtp->message(); $smtp->dataend() or die "Error:".$smtp->message(); $smtp->quit or die "Error:".$smtp->message();

In reply to Trouble with sending more than one attachment by ytjPerl

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.