透過 shell script 發送 email

 如果想用 script 發送郵件,可以用 實現:

# echo “email content” | mail -s “email subject” you@emaildomain

以上語句會發送一封標題為 “email subject” 的電郵到 you@emaildomain,其中 “email content” 為電郵內容。 以下簡單的兩行 shell script 便會將檔案系統使用量,透過電郵發送給指定的電郵信箱:

 #!/bin/sh /bin/df -h | /usr/bin/mail -s “server capacity” you@emaildomain

来自:http://www.real-blog.com/-bsd-notes/444

原创文章,转载请注明: 转载自PT Ubuntu Blog

本文链接地址: http://www.ptubuntu.com/2008/11/292.html

Share

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Verify Code   If you cannot see the CheckCode image,please refresh the page again!