云服务器免费试用

Linux的sendmail命令怎么使用

服务器知识 0 327

sendmail是一个用于发送邮件的命令行工具,常用于Linux系统。下面是sendmail命令的用法:
1. 发送简单的文本邮件:
```
echo "This is the body of the email" | sendmail recipient@example.com
```
这个命令会将文本"This is the body of the email"作为邮件正文发送给recipient@example.com。
2. 发送带有主题和发件人的邮件:
```
echo "This is the body of the email" | sendmail -s "Subject of the email" -f sender@example.com recipient@example.com
```
这个命令会将文本"This is the body of the email"作为邮件正文发送给recipient@example.com,同时指定邮件主题为"Subject of the email",发件人为sender@example.com。
3. 发送带有附件的邮件:
```
(echo "This is the body of the email"; uuencode attachment.txt attachment.txt) | sendmail -s "Subject of the email" -f sender@example.com recipient@example.com
```
这个命令会将文本"This is the body of the email"作为邮件正文发送给recipient@example.com,同时指定邮件主题为"Subject of the email",发件人为sender@example.com,并且附加了名为attachment.txt的附件。
4. 从文件中读取邮件内容:
```
sendmail -t ```
这个命令会从名为email.txt的文件中读取邮件内容,并发送。
以上是sendmail命令的一些常用用法,你可以根据自己的需求进行调整和扩展。

Linux的sendmail命令怎么使用

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942@qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: Linux的sendmail命令怎么使用
本文地址: https://solustack.com/51457.html

相关推荐:

网友留言:

我要评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。