> Hi Brian Hello,
> > > Hi All, > > > > I thought I had this figured out but I was wrong. The part > I'm having > > trouble w/ is getting the loop to attach the correct > html_file. Right now > > that program will attach this file every time: > > > > my $html_file = 'c:\brian\test\html\12345.htm'; > > This is exactly what you express with your code, see below: I've made some minor changes.... > > > What I would like to happen is if f ($_ eq $html) to attach > that html doc. > > and then the next time through attach the html doc. that eq > the next $_ > > > > BTW each .txt file contains random item numbers (text) that > matches an html > > doc. for example. > > > > c:\brian\test\orders\10001.txt might include: > > 12345.html > > 12346.html > > > > .... so I would like the correct html doc to be attached to > that email and > > so on... > > > > The attachment is being renamed to correctly... but I have > a feeling if the > > program worked correctly, I wouldn't have to rename it > attachment.. :~) > > Can someone pls help... Thanks! > > > > #!/usr/bin/perl > > > > use strict; > > use warnings; > > use MIME::Lite; > > use Net::SMTP; > > > > my $html_dir = "C:/brian/test/html"; > > > > opendir(DIR, $html_dir) or die "Can't open the $html_dir: $!\n"; > > > > # read file/directory names in that directory into @htmls > > > > my @htmls = readdir(DIR) or die "Unable to read current dir:$!\n"; > > > > closedir(DIR); > > > > my $orders_dir = "C:/brian/test/orders"; > > opendir (ORDERS, $orders_dir) or die "Can't open $orders_dir: $!"; > > > > # read all the item numbers in all the .txt files and > > # load @ARGV for <> operator > > > > @ARGV = map { "$orders_dir/$_" } grep { !/^\./ } readdir ORDERS; > > > > while (<>) { > > chomp; > > # email information > > my $from_address = <mailto:'[EMAIL PROTECTED]'> '[EMAIL PROTECTED]'; > > my $to_address = <mailto:'[EMAIL PROTECTED]'> > '[EMAIL PROTECTED]'; > > my $mail_host = 'smtp.bvolk.com'; > > my $subject = 'Test eMail'; > > my $message_body = "Attached is the msds for $ARGV"; > > my $html_file = 'c:\brian\test\html\12345.htm'; I take it I should comment out the line above... > > Here you specify your file... > > > foreach my $html (@htmls) { > > if ($_ eq $html) > > my $msg = MIME::Lite->new ( > > From => $from_address, > > To => $to_address, > > Subject => $ARGV, > > Type =>'multipart/mixed' > > ) or die "Error creating multipart container: $!\n"; > > > > $msg->attach ( > > Type => 'TEXT', > > Data => $message_body > > ) or die "Error adding the text message part: $!\n"; > > > > $msg->attach ( > > Type => 'application', > > Path => $html_file, ... should I change the line above to Path => $html, if I do that I get "12345.html: not readable. Any ideas? Thanks for the help. > > ...which you attach in the above line every time. > > > Filename => $_, > > Disposition => 'attachment' > > ) or die "Error adding $html_file $!\n"; > > > > MIME::Lite->send('smtp', $mail_host, Timeout=>60); > > $msg->send; > > } > > } > > } > > > > closedir (ORDERS); > > > > > > Brian Volk > > HP Products > > 317.298.9950 x1245 > > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>