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 from=123456@qq.com
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" 123456@qq.com