need some new ideas

Take a look at Email::Stuffer

#!/usr/bin/perl use strict; use warnings; use Sys::Hostname; use Email::Sender::Transport::SMTP; use Email::Stuffer; my $from = '***@****.com'; my $to = '***@****.com'; my $cc; if ($ARGV[-1] eq '-t'){ pop @ARGV; $cc = '****@*****.com'; } if (@ARGV < 1 or @ARGV > 2){ usage(); exit; } my $host = hostname(); my $logfile = $ARGV[0]; die "$logfile does not exists " unless (-e $logfile); my $subject = $ARGV[1] || "$host: $logfile"; my $msg = Email::Stuffer->new({ from => $from, to => $to, subject => $subject, text_body=> "Here is attachment"}); $msg->cc($cc) if $cc; $msg->attach_file($logfile); #print $msg->as_string; my $transport_obj = Email::Sender::Transport::SMTP->new({ host => '****', debug => 1, }); $msg->transport( $transport_obj ); $msg->send_or_die; sub usage { print << "EOF"; usage : mailsend.pl <logfile> [subject] [-t] syntax : logfile is required. [subject] is optional. [-t] specifies to send a copy to maileater print "example: mailsend.pl /tmp/test.log print "example: mailsend.pl /tmp/test.log Test print "example: mailsend.pl /tmp/test.log Test -t EOF }
poj

In reply to Re: Send an email attachment by poj
in thread Send an email attachment by AmyB

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.