(linux)mail/mailx命令[随笔记录]

debian下安装
aptitude install heirloom-mailx

配置文件是
/etc/nail.rc

配置默认服务器
set from=xxx@qq.com
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=xxx@qq.com
set smtp-auth-password=password

可选服务器配置
account accountname {
set from=xxx@163.com
set smtp=smtp://smtp.163.com:25
set smtp-auth-user=xxx@163.com
set smtp-auth-password=password
}

用管道符直接发送
echo “neirong” | mail -s “主题” dizhi@domain.com

用Enter.Enter发送
mail -s “主题” dizhi@domain.com

发送时显示详细信息
mail -v -s “主题” dizhi@domain.com

带附件发送
mail -v -a /path/filename -s “主题” dizhi@domain.com

用指定账号发邮件
mail -A accountname -v -a /path/filename -s “主题” dizhi@domain.com

——— <文章结束> ———

原文地址:https://www.cnblogs.com/enumx/p/12409681.html