Linux 拨号vps windows公众号手机端

Linux的sendmail命令怎么使用

lewis 6年前 (2019-11-27) 阅读数 8 #网络运维
文章标签 sendmail

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。

  1. 发送带有主题和发件人的邮件:
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。

  1. 发送带有附件的邮件:
(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的附件。

  1. 从文件中读取邮件内容:
sendmail -t < email.txt

这个命令会从名为email.txt的文件中读取邮件内容,并发送。

以上是sendmail命令的一些常用用法,你可以根据自己的需求进行调整和扩展。

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

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

热门