使用postfix搭建匿名smtp服务器

iDaemon » 使用postfix搭建匿名smtp服务器

使用postfix搭建匿名smtp服务器

昨天尝试架设了sendmail作为smtp服务器发信,今天换用了传说中评价更好的postfix来实验。

 

零. 环境简介

Centos 5.7 x64

postfix-2.3.3-2.3.el5_6

Postfix与sendmail相比的主要优点:

1. 效率更高,并完全兼容sendmail;

2. 健壮可靠,内存不足时会自动减少线程,保证可用性;

3. 使用灵活,各组分都可以定制参数,完成特定的某个功能;

4. 安全性高,易于扩展和二次开发。

 

一. 搭建流程

1. 禁用sendmail

service sendmail stop

chkconfig sendmail off

2. 安装postfix

yum install postfix -y

3. 配置postfix的conf

vi /etc/postfix/main.cf

mydomain=test.com

myorigin=$mydomain

inet_interfaces=all

# 注意,要把默认的inet_interfaces=localhost删除或注释掉

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

mynetworks=10.0.0.0/8, 127.0.0.0/8

# 内网用

4. 检测conf

postconf -n

如果未报错,即通过检测

5. 启动postfix并添加到自启动

service postfix start

chkconfig postfix on

 

二. smtp发信测试

# telnet 127.0.0.1 25

Trying 127.0.0.1…

Connected to Mornitor (127.0.0.1).

Escape character is ‘^]’.

220 CentOS.test.com ESMTP Postfix

helo test.com

250 CentOS.test.com

mail from: f@fda.com

250 2.1.0 Ok

rcpt to:XXXXXX@139.com

# 此处邮件地址隐去 :P

250 2.1.5 Ok

data

354 End data with <CR><LF>.<CR><LF>

subject:test

this is a test mail

.

250 2.0.0 Ok: queued as 5F92D110044

quit

Feb 3 12:34:45 Mornitor postfix/qmgr[25954]: 5F92D110044: from=<f@fda.com>, size=344, nrcpt=1 (queue active)

Feb 3 12:34:59 Mornitor postfix/smtp[26020]: 5F92D110044: enabling PIX <CRLF>.<CRLF> workaround for mx1.mail.139.com[221.176.9.178]:25

Feb 3 12:35:10 Mornitor postfix/smtp[26020]: 5F92D110044: to=<XXXXXX@139.com>, relay=mx1.mail.139.com[221.176.9.178]:25, delay=1930, delays=1905/0.01/12/13, dsn=2.0.0, status=sent (250 ok)

Feb 3 12:35:10 Mornitor postfix/qmgr[25954]: 5F92D110044: removed

片刻后手机也收到了该邮件,测试成功

 

三. 备注

1. postfix的配置与sendmail相比同样便捷,几分钟内即可搭建出一个可用的测试发信服务器;

2. sendmail一般在centos中直接内置并已设置为默认MTA,如果没有特殊需求可以直接拿来用;

3. 如果为了长远使用,还是选择postfix较为合适,它可以很方便地加上各类扩展,如反垃圾,防病毒等。

4. saslauthd 为实现SMTP认证的必选组件,此篇笔记中由于无此需求,予以省略了;

5. 无论使用何种MTA架设匿名smtp,一定要注意设置访问策略,防止被恶意用户利用,发送大量垃圾邮件!

 

四. 主要参考文献

余洪春. (2011). 构建高可用Linux服务器. 北京: 机械工业出版社. P501-502.

posted on 2012-12-02 22:58  lexus 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lexus/archive/2012/12/02/2798817.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值