Chinaunix首页 | 论坛 | 博客
  • 博客访问: 465799
  • 博文数量: 279
  • 博客积分: 4467
  • 博客等级: 上校
  • 技术积分: 2830
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-03 14:43
文章分类

全部博文(279)

文章存档

2013年(1)

2012年(39)

2011年(35)

2009年(29)

2008年(131)

2007年(44)

分类:

2007-12-07 12:26:42


1、File::Basename modules: 根据路径分离出文件的路径名、文件名或者扩展名。
use File::Basename; 
($filename, $directories, $suffix) = fileparse($path);

2、File::Spec modules: 与File::Basename相反, 将文件名和目录名结合以取得文件的全名。

use File::spec;
##which returns 'a/b/c' under Unix
$x=File::Spec->catfile('a', 'b', 'c');
3、CGI.pm

4、Net::smtp modules: 发送邮件

5、Tie::File module:
Access the lines of a disk file via a Perl array
通过perl数组来访问文件的每行

%7Emjd/Tie-File-0.96/lib/Tie/File.pm#___top
6 Date::Manip: 日期操作模块。
my $date=&DateCalc("today","-1 days", 0);#获取昨天的日期;

7 use MIME::Lite
use Net::SMTP ##发送邮件所使用的模块,并且可以发送各种类型的附件,指定发件人和收件人。
my $from_address = 'xx@163.com';
my $to_address = 'xx@sina.com';
my $mail_host = 'mail.server.net';
my $result='  access';##body
### Adjust subject and body message
my $subject = 'check';

### Adjust the filenames
my $my_file_html = 'index.html';
my $your_file_html = 'index.html';

### Create the multipart container

$msg = MIME::Lite->new (
  From => $from_address,
  To => $to_address,
  Subject => $subject,
  Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";

### Add the text message part
$msg->attach (
  Type => 'TEXT',
  Data => $result,
) or die "Error adding the text message part: $!\n";

### Add the html file
$msg->attach (
   Type => 'HTML',
   Path => $my_file_html,
   Filename => $your_file_html,
   Disposition => 'html'
) or die "Error adding $file_html: $!\n";


### Send the Message
MIME::Lite->send('smtp', $mail_host, Timeout=>60);
$msg->send;


阅读(446) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~