Shell脚本发送电子邮件 [英] Shell script to send email

查看:148
本文介绍了Shell脚本发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在linux机器上,我监视进程的使用情况。大多数时间我将远离我的系统,我可以在我的设备上访问互联网。所以我打算写一个可以邮寄过程的输出的shell脚本。



可以吗?



如果是这样,shell脚本如何发送邮件?



请提供一个代码段来开始。

解决方案

是的,它可以正常工作,常用:

  $ echohello world| mail -s主题someone@somewhere.com 


I am on linux machine and I monitor a process usage. Most of the time I will be away from my system and I have access to internet on my device. So I planned to write a shell-script that can mail me the output of the process.

Is it possible?

If so how to make a shell-script send me mail?

Please provide a snippet to get started.

解决方案

Yes it works fine and is commonly used:

$ echo "hello world" | mail -s "a subject" someone@somewhere.com

这篇关于Shell脚本发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆