从 linux shell 脚本发送邮件 [英] Sending a mail from a linux shell script

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

问题描述

我想从 Linux Shell 脚本发送电子邮件.执行此操作的标准命令是什么,我是否需要设置任何特殊的服务器名称?

I want to send an email from a Linux Shell script. What is the standard command to do this and do I need to set up any special server names?

推荐答案

如果服务器配置良好,例如它有一个启动并正在运行的 MTA,你可以只使用 mail 命令.

If the server is well configured, eg it has an up and running MTA, you can just use the mail command.

例如,要发送文件的内容,您可以这样做:

For instance, to send the content of a file, you can do this:

$ cat /path/to/file | mail -s "your subject" your@email.com

man mail 了解更多详情.

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

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