hi

this perl script should be scheduled every 1 minute.
it should look for a doc file and send it with the original name as attachment by mail.
every doc file has other name.
after the file was sent, it should create a backup direktory and move the file there.

I have 3 problems:
1.) my first problem is:
/srv/ftp/lc/*.DOC: not readable

2.) I'll send a file with a original name
Filename =>'?',

3.) sometimes I'm getting 3 or more files at the same time , but must send only one file in one mail.
I don't know, how can I change that.
#!/usr/bin/perl -w use strict; use warnings; use MIME::Lite; use Net::SMTP; my $mail_host = "192.168.1.1"; my $linux = "root\@mydomain.net"; my $recipient = "recipient\@mydomain.net"; my $file = "/srv/ftp/lc/*.DOC"; my $subject = "invoice"; # send a mail with the attachment my $msg = MIME::Lite->new( From => "$linux" , To => "$recipient" , Subject => "$subject", Type => 'multipart/mixed', ); $msg->attach(Type =>'TEXT', Data =>"invoice" ); $msg->attach(Type =>'application/doc', Path =>"$file", Filename =>'?', Disposition => 'attachment' ); # ----- Tell MIME::Lite to use Net::SMTP instead of sendmail MIME::Lite->send('smtp', $mail_host, Timeout=>60); $msg->send; # create a backup subfolder after mail was sent my @dt = localtime; my $subfolder_name = ((((1900 + $dt[5]) * 100 + 1 + $dt[4]) * 100 + $d +t[3]) * 100 + $dt[2]) * 100 + $dt[1]; mkdir "/srv/ftp/lc/save/$subfolder_name" or die "$subfolder_name: $!"; # move the file to the backup subfolder system("mv $file /srv/ftp/lc/save/$subfolder_name"); exit;

could someone help me pls ?

In reply to look for a file and send as a mail attachment by mail by cc

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.