Chinaunix首页 | 论坛 | 博客
  • 博客访问: 384067
  • 博文数量: 87
  • 博客积分: 2810
  • 博客等级: 少校
  • 技术积分: 825
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 22:34
文章分类

全部博文(87)

文章存档

2010年(25)

2009年(43)

2008年(19)

分类: LINUX

2009-04-22 23:43:11

#!/usr/local/bin/perl -w
# Send message with attachments
# Instaill Perl Module
# perl -MCPAN -e shell
# Terminal does not support AddHistory.
# cpan shell -- CPAN exploration and modules installation (v1.7602)
# ReadLine support available (try 'install Bundle::CPAN')
# cpan> install Time::Format
 
use MIME::Lite;
use Time::Format;
$yt = $time{'yyyymmdd'};
$TXTFILE="/root/$yt-checkmtree.txt";
#$ATTFILE="/root/mtree2.txt";
$SUBJECT="Mtree Check Out ";
$MAILTO="dengxb\@kevinagios.com";
# Create a new multipart message:
$msg = new MIME::Lite
   From    => "$ENV{LOGNAME}",
   To      => "$MAILTO",
   Subject => "$SUBJECT",
   Type    => 'multipart/mixed';
       
# Add parts (each "attach" has same arguments as "new"):
attach $msg
   Type     => 'text/plain',  
   Path     => "$TXTFILE";
#attach $msg
#   Type     => 'application/octet-stream',
#   Encoding => 'base64',
#   Path     => "/tmp/$ATTFILE",
#   Filename => "$ATTFILE";
# Output the message to sendmail
open (SENDMAIL, "| /usr/sbin/sendmail -t -oi");
$msg->print(\*SENDMAIL);
close(SENDMAIL);
阅读(1495) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~