# 使用 mail 命令发送邮件的示例
# 1. 发送简单文本邮件
mail -s "Subject of the Email" recipient@example.com <<< "This is the body of the email."
# 解释:
# - `-s "Subject of the Email"`: 设置邮件的主题为 "Subject of the Email"
# - `recipient@example.com`: 收件人的电子邮件地址
# - `<<< "This is the body of the email."`: 这是邮件的正文内容
# 2. 发送带有附件的邮件
echo "This is the body of the email." | mail -s "Subject of the Email" -a /path/to/attachment recipient@example.com
# 解释:
# - `-a /path/to/attachment`: 指定附件的路径
# - 其他参数同上
# 3. 从文件中读取邮件正文内容
mail -s "Subject of the Email" recipient@example.com < /path/to/email_body.txt
# 解释:
# - `< /path/to/email_body.txt`: 从指定文件中读取邮件正文内容
如果需要更多关于 mail
命令的帮助,可以使用 man mail
查看手册页。
上一篇:linux更改ip地址
下一篇:linux中创建文件的命令
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站