1. 修改hostname(例如:kobe.com)
root@kobe:/etc# cat /etc/hostname
kobe.com
root@kobe:/etc#
hostnamectl set-hostname xxx.org
2. 安装sendmail
root@kobe:# apt-get install sendmail -y
3. 编辑/etc/mail/local-host-names
1 root@kobe:/etc# cat /etc/mail/local-host-names
2 kobe.com
3 root@kobe:/etc#
4. 配置sendmail
root@vubuntu32:/home/comodo# sendmailconfig
>Configure sendmail with the existing /etc/mail/sendmail.conf? [Y] y
>Configure sendmail with the existing /etc/mail/sendmail.mc? [Y] y
>Reload the running sendmail now with the new configuration? [Y] y
5. 检测sendmail
root@vubuntu32:/home/comodo# netstat -napt|grep sendmail
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 8860/sendmail: MTA:
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 8860/sendmail: MTA:
6. 检测版本:
1 root@kobe:/etc# telnet localhost 25
2 Trying 127.0.0.1...
3 Connected to localhost.
4 Escape character is '^]'.
5 220 kobe.com ESMTP Sendmail 8.14.4/8.14.4/Debian-4.1ubuntu1; Tue, 8 Jul 2014 08:26:38 -0700; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
7. 更新sendmail.mc
<1. From
DAEMON_OPTIONS(`Familiy=inet, Port=smtp,Addr=127.0.0.1, Name=MTA-v4')
To:
DAEMON_OPTIONS(`Familiy=inet, Port=smtp,Addr=0.0.0.0 Name=MTA-v4')
<2. root@kobe# m4 sendmail.mc > sendmail.cf
8.重启sendmail
root@kobe:/etc#service sendmail restart
9.test
root@kobe:/etc/mail# echo jjjj | mail -s test 303841541@qq.com
10.result
Jul 8 08:32:10 kobe sendmail[3126]: s68FWAVS003126: from=root@kobe.com, size=82, class=0, nrcpts=1, msgid=<201407081532.s68FWAVS003126@kobe.com>, relay=root@localhost
Jul 8 08:32:11 kobe sm-mta[3127]: s68FWAfC003127: from=<root@kobe.com>, size=316, class=0, nrcpts=1, msgid=<201407081532.s68FWAVS003126@kobe.com>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Jul 8 08:32:11 kobe sendmail[3126]: s68FWAVS003126: to=<303841541@qq.com>, ctladdr=root@kobe.com (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30082, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (s68FWAfC003127 Message accepted for delivery)
Jul 8 08:32:11 kobe sm-mta[3130]: STARTTLS=client, relay=mx3.qq.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
Jul 8 08:32:12 kobe sm-mta[3130]: s68FWAfC003127: to=<303841541@qq.com>, ctladdr=<root@kobe.com> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120316, relay=mx3.qq.com. [113.108.16.62], dsn=5.0.0, stat=Service unavailable
Jul 8 08:32:12 kobe sm-mta[3130]: s68FWAfC003127: s68FWCfC003130: DSN: Service unavailable
Jul 8 08:32:12 kobe sm-mta[3130]: s68FWCfC003130: to=<root@kobe.com>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30000, dsn=2.0.0, stat=Sent
Jul 8 08:33:37 kobe sendmail[3141]: s68FXauW003141: from=root@kobe.com, size=80, class=0, nrcpts=1, msgid=<201407081533.s68FXauW003141@kobe.com>, relay=root@localhost
Jul 8 08:33:37 kobe sm-mta[3142]: s68FXb1F003142: from=<root@kobe.com>, size=314, class=0, nrcpts=1, msgid=<201407081533.s68FXauW003141@kobe.com>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Jul 8 08:33:37 kobe sendmail[3141]: s68FXauW003141: to=<xxxxx@126.com>, ctladdr=root@kobe.com (0/0), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30080, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (s68FXb1F003142 Message accepted for delivery)
Jul 8 08:33:42 kobe sm-mta[3144]: STARTTLS=client, relay=126mx02.mxmail.netease.com., version=TLSv1/SSLv3, verify=FAIL, cipher=AES256-GCM-SHA384, bits=256/256
Jul 8 08:33:46 kobe sm-mta[3144]: s68FXb1F003142: to=<xxxxx@126.com>, ctladdr=<root@kobe.com> (0/0), delay=00:00:09, xdelay=00:00:09, mailer=esmtp, pri=120314, relay=126mx02.mxmail.netease.com. [176.34.55.247], dsn=2.0.0, stat=Sent (Mail OK queued as mx31,ycmowECZx0ZjD7xT7e4uBQ--.781S3 1404833642)
网友评论