我有一个Perl脚本,可以在屏幕上输出多行输出。我需要捕获这些行,并将它们传送到一个电子邮件(/ bin/mail)或一个文本文件中,以便在另一个操作中通过/ bin邮件发送。实际上,我已经找到了简单(愚蠢)的方法,我使用bash包装来做邮件。看起来像,如何将Perl的多行输出发送到/ bin/mail?
#!/usr/bin/bash
source /nethome/zog/.bash_profile
cd /nethome/zog/bin/perl
/nethome/zog/bin/perl/find_free_space.pl > text.file
/bin/mail -s [email protected] [email protected] < text.file
我想要使用Net :: SMTP做smtp位。至少可以说,上述不雅。
我看到了这样的事情:在计算器
open(MAIL, "| /bin/mail -s FreePorts me\@geemail.com") ||
die "mail failed: $!\n"; print MAIL "This is how it goes."
,但未能在标准输出重定向到邮件。我使用的是:
$complete_output .= "\n"; "|/bin/mail -s FreePorts zog\@geeemail.com" || die "mail failed: $!\n";
我不知道,如果你都需要看到的Perl脚本,以帮助,但it is on pastebin。请告诉我。
你来得很近,请参阅http://stackoverflow.com/questions/655719/how-do-i-unalias-from-perls-stdout – msw 2010-09-23 03:34:33