mail命令
1.關閉本機的sendmail服務或者postfix服務
#執行下面的命令,各位大俠都對號入座吧
#sendmial
service sendmail stop
chkconfig sendmail off
#postfix
service postfix stop
chkconfig postfix off
#再狠一點就直接卸載吧..
yum remove sendmail
yum remove postfix
2、然後修改/etc/mail.rc,在文件末尾增加以下內容,指定外部的smtp服務器地址、帳號密碼等
$ vim /etc/mail.rc
set [email protected]
set smtp=smtp.qq.com
set smtp-auth-user=123456
set smtp-auth-password=“寫入底下生成的授權碼”
set smtp-auth=login
這裏使用了QQ郵箱的SMTP,需要做以下配置:
設置---->下面的開啓服務那裏---->生成授權碼
3、然後通過命令來發送郵件
echo hello word | mail -s " title" [email protected]