您的位置:首页 > 运维架构 > Linux

centos6.5安装sendmail

2016-02-02 17:28 567 查看
1.下载安装sendEmail(下载绿色版,解压可直接使用)

wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz tar -xzvf sendEmail-v1.56.tar.gz
mv sendEmail-v1.56 /usr/local/sendemail
ln -s /usr/local/sendemail/sendEmail /usr/sbin/sendmail


2.发送邮件

sendmail -f xpeka@163.com -t 3956865697@qq.com -s smtp.163.com -u "邮件主题" -o message-content-type=html -o message-charset=utf8 -xu xpeka -xp xxxx -m "邮件内容"


命令说明:

sendmail:邮件主程序

-f x.peka@163.com:发件人邮箱

-t 494865597@qq.com:收件人邮箱

-s smtp.163.com:发件人的smtp服务器地址

-u "邮件主题":邮件的标题

-o message-content-type=html:邮件内容的格式,html表示它是html格式

-o message-charset=utf8:邮件内容编码

-xu x.peka:发件人的邮箱账号

-xp xxxx:发件人邮箱密码

-m "邮件内容":邮件的具体内容


发送成功之后会有如下提示:

[root@localhost myshell]# sendmail -f xpeka@163.com -t 3956865697@qq.com -s smtp.163.com -u lwj -o message-content-type=html -o message-charset=utf8 -xu xpeka -xp xxxx -m lzy

Feb 02 17:17:30 localhost sendmail[6652]: Email was sent successfully!


#!/bin/sh
to=$1
subject=$2
body=$3
sendemail -f x.peke@163.com -t "$to" -s smtp.163.com -u "$subject" -o message-content-type=html -o message-charset=utf8 -xu x.peka -xp l123456 -m "$body" >>/tmp/sendemail.log
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: