Next Trivial Utilities 146

attach

        my $msg = MIME::Lite->new(From    => $from,
                                  To      => $opt_t,
                                  Subject => $opt_s,
                                  Type    => 'TEXT',
                                  Data    => \@MSG);  
        for (@ARGV) {
          my ($suf) = (/\.([^.]*)$/);
          my $type = $type{lc $suf} || 'application/octet-stream';
          $msg->attach(Type     => $type,
                       Path     => $_);
        }
        $msg->print(\*OUTPUT);
        exit 0;
        %type = ('gif' => 'image/gif',
                 'jpg' => 'image/jpeg',
                 'jpeg' => 'image/jpeg',
                 'pdf'  => 'application/pdf',
                 'html' => 'text/html',
                 'htm' => 'text/html',
                 'txt' => 'text/plain',
                );


Next Menu Copyright © 2012 M. J. Dominus