红联Linux门户
Linux帮助

POSTFIX 邮件服务器搭建问题

发布时间:2011-11-15 12:10:22来源:红联作者:568040142
以下是我的配置文件,我是centos 5.4 防火墙和SELINUX都是关闭

myhostname = calysc
myorigin = $myhostname
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost,
linux.centos.vbird, ftp.centos.vbird
mynetworks = 127.0.0.0/8, 192.168.1.0/24, hash:/etc/postfix/access
relay_domains = $mydestination
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

------------------------------------
service postfix start 出现以下错误日志:
Nov 15 11:56:10 gzpro1 sendmail[17940]: alias database /etc/aliases rebuilt by root
Nov 15 11:56:10 gzpro1 sendmail[17940]: /etc/aliases: 76 aliases, longest 10 bytes, 765

bytes total
Nov 15 11:56:10 gzpro1 postfix/postfix-script: starting the Postfix mail system
Nov 15 11:56:10 gzpro1 postfix/master[17986]: fatal: bind 0.0.0.0 port 25: Address already

in use
---------------------------------
然后把inet_interfaces = all 改成 inet_interfaces = $myhostname 出现以下错误日志
Nov 15 11:57:58 gzpro1 sendmail[18010]: alias database /etc/aliases rebuilt by root
Nov 15 11:57:58 gzpro1 sendmail[18010]: /etc/aliases: 76 aliases, longest 10 bytes, 765

bytes total
Nov 15 11:57:59 gzpro1 postfix/postfix-script: starting the Postfix mail system
Nov 15 11:57:59 gzpro1 postfix/master[18056]: fatal: bind 127.0.0.1 port 25: Address

already in use
-----------------------------------
问题1: 到底是出了什么问题,我软件没装好? 我是用yum install postfix 安装的.
还是版本问题? 还是我配置文件写错了吗?


====================我是分割线===========================
另外我输入
[root@gzpro1 ~]# postqueue -p
postqueue: warning: Mail system is down -- accessing queue directly
Mail queue is empty
问题2 : 这又是什么问题?


====================我是分割线===========================
还有我输入
[root@gzpro1 ~]# echo "sss" | mail -s "123" root
[root@gzpro1 ~]# /etc/mail/submit.cf: line 432: readcf: option RunAsUser: unknown user

smmsp
/etc/mail/submit.cf: line 451: readcf: option TrustedUser: unknown user smmsp
Mail submission program must have RunAsUser set to non root user

这时候我没开邮件服务器,应该放入等待列表里面的,但是却出现了这个,是怎么回事呢?
我是新手,请各位大虾帮帮忙解决,跪谢!
文章评论

共有 12 条评论

  1. billloves 于 2012-02-08 10:35:38发表:

    来学习一下,最近自己想搭建一个小型的邮件服务器,不知道选什么好。所以来看看

  2. 568040142 于 2011-11-29 15:24:03发表:

    没有同时用,早就关了sendmail了,貌似是依赖问题没有搞好。

  3. alick 于 2011-11-22 12:03:11发表:

    sendmail 和 postfix 不能同时用吧,二者都是邮件发送服务器

  4. 568040142 于 2011-11-21 13:56:35发表:

    OK 现在知道是我的DNS问题了, 至于mail是sendmail没有配置好的问题。

  5. alick 于 2011-11-19 11:21:21发表:

    引用:
    to=<calys@calysc.localdomain>, relay=none, delay=0.05, delays=0.04/0/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=calysc.localdomain type=A: Host not found

    calysc.localdomain 这个域名解析不出来啊,所以发不出去,结果bounce(弹回)了

  6. 568040142 于 2011-11-18 12:08:52发表:

    sendmail大概停掉了。netstat -tunlp | grep sendmail 没有显示。
    至于为什么会弹回我也不知道。。
    至于外发邮件, 我用雷鸟测试了下,发不出邮件,错误日志如下 :
    Nov 18 12:00:44 gzpro1 dovecot: imap-login: Login: user=, method=PLAIN, rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31
    Nov 18 12:00:47 gzpro1 dovecot: imap-login: Login: user=, method=PLAIN, rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31
    Nov 18 12:00:48 gzpro1 dovecot: imap-login: Login: user=, method=PLAIN, rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31
    Nov 18 12:00:59 gzpro1 dovecot: IMAP(calys): Disconnected: Logged out
    Nov 18 12:00:59 gzpro1 dovecot: IMAP(calys): Disconnected: Logged out
    Nov 18 12:01:22 gzpro1 dovecot: imap-login: Aborted login: rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31
    Nov 18 12:01:31 gzpro1 last message repeated 9 times
    Nov 18 12:01:34 gzpro1 dovecot: imap-login: Login: user=, method=PLAIN, rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31
    Nov 18 12:01:34 gzpro1 dovecot: IMAP(calys): Disconnected: Logged out
    Nov 18 12:01:37 gzpro1 dovecot: imap-login: Login: user=, method=PLAIN, rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31
    Nov 18 12:01:50 gzpro1 postfix/smtpd[8309]: connect from 71calysc[210.38.5.71]
    Nov 18 12:01:50 gzpro1 postfix/smtpd[8309]: 3D004D8A42: client=71calysc[210.38.5.71]
    Nov 18 12:01:50 gzpro1 postfix/cleanup[8312]: 3D004D8A42: message-id=<4EC5D7F2.2090305@calysc>
    Nov 18 12:01:50 gzpro1 postfix/qmgr[8214]: 3D004D8A42: from=<calys@calysc.localdomain>, size=496, nrcpt=1 (queue active)
    Nov 18 12:01:50 gzpro1 postfix/smtpd[8309]: disconnect from 71calysc[210.38.5.71]
    Nov 18 12:01:50 gzpro1 postfix/smtp[8313]: 3D004D8A42: to=<haha@calysc.localdomain>, orig_to=, relay=none, delay=0.13, delays=0.09/0.01/0.04/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=calysc.localdomain type=A: Host not found)
    Nov 18 12:01:50 gzpro1 postfix/cleanup[8312]: 650FCD8A45: message-id=<20111118040150.650FCD8A45@calysc>
    Nov 18 12:01:50 gzpro1 postfix/qmgr[8214]: 650FCD8A45: from=<>, size=2356, nrcpt=1 (queue active)
    Nov 18 12:01:50 gzpro1 postfix/bounce[8314]: 3D004D8A42: sender non-delivery notification: 650FCD8A45
    Nov 18 12:01:50 gzpro1 postfix/qmgr[8214]: 3D004D8A42: removed
    Nov 18 12:01:50 gzpro1 postfix/smtp[8313]: 650FCD8A45: to=<calys@calysc.localdomain>, relay=none, delay=0.05, delays=0.04/0/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=calysc.localdomain type=A: Host not found)
    Nov 18 12:01:50 gzpro1 postfix/qmgr[8214]: 650FCD8A45: removed
    Nov 18 12:01:50 gzpro1 dovecot: imap-login: Login: user=, method=PLAIN, rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31
    Nov 18 12:01:52 gzpro1 dovecot: imap-login: Login: user=, method=PLAIN, rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31
    Nov 18 12:01:54 gzpro1 dovecot: imap-login: Login: user=, method=PLAIN, rip=::ffff:210.38.5.71, lip=::ffff:210.38.5.31

  7. alick 于 2011-11-17 23:21:37发表:

    我想问楼主的sendmail服务停掉没,怎么还有sendmail的日志消息?
    postfix显示几封邮件都被bounced(弹回)了,因为收件人就在本地。
    不太清楚为什么会bounce,但楼主有没有试过向外发送邮件是否正常
    (比如自己在163的邮箱等)

  8. 568040142 于 2011-11-17 17:37:07发表:

    感谢alick大大的回答 但是现在又有新问题了。。
    输入 echo "1230" | mail -s "11" root
    然后maillog里面提示错误 这是开了postfix 的
    Nov 17 17:34:02 gzpro1 sendmail[11807]: pAH9Y2F5011807: from=root, size=27, class=0, nrcpts=1, msgid=<201111170934.pAH9Y2F5011807@gzpro1.guangztr.edu.cn>, relay=root@localhost
    Nov 17 17:34:03 gzpro1 postfix/smtpd[11798]: connect from calysc[127.0.0.1]
    Nov 17 17:34:03 gzpro1 postfix/smtpd[11798]: 08A99D8A42: client=calysc[127.0.0.1]
    Nov 17 17:34:03 gzpro1 postfix/cleanup[11801]: 08A99D8A42: message-id=<201111170934.pAH9Y2F5011807@gzpro1.guangztr.edu.cn>
    Nov 17 17:34:03 gzpro1 sendmail[11807]: pAH9Y2F5011807: to=root, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30027, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 08A99D8A42)
    Nov 17 17:34:03 gzpro1 postfix/qmgr[11762]: 08A99D8A42: from=<root@gzpro1.guangztr.edu.cn>, size=529, nrcpt=1 (queue active)
    Nov 17 17:34:03 gzpro1 postfix/smtp[11802]: 08A99D8A42: to=<root@gzpro1.guangztr.edu.cn>, relay=none, delay=0.07, delays=0.07/0/0/0, dsn=5.4.6, status=bounced (mail for gzpro1.guangztr.edu.cn loops back to myself)
    Nov 17 17:34:03 gzpro1 postfix/cleanup[11801]: 21A04D8A45: message-id=<20111117093403.21A04D8A45@calysc>
    Nov 17 17:34:03 gzpro1 postfix/bounce[11803]: 08A99D8A42: sender non-delivery notification: 21A04D8A45
    Nov 17 17:34:03 gzpro1 postfix/smtpd[11798]: disconnect from calysc[127.0.0.1]
    Nov 17 17:34:03 gzpro1 postfix/qmgr[11762]: 08A99D8A42: removed
    Nov 17 17:34:03 gzpro1 postfix/qmgr[11762]: 21A04D8A45: from=<>, size=2288, nrcpt=1 (queue active)
    Nov 17 17:34:03 gzpro1 postfix/smtp[11802]: 21A04D8A45: to=<root@gzpro1.guangztr.edu.cn>, relay=none, delay=0.04, delays=0.04/0/0/0, dsn=5.4.6, status=bounced (mail for gzpro1.guangztr.edu.cn loops back to myself)
    Nov 17 17:34:03 gzpro1 postfix/qmgr[11762]: 21A04D8A45: removed

    这是没开postfix 的
    Nov 17 17:35:50 gzpro1 sendmail[11838]: pAH9ZoUf011838: from=root, size=27, class=0, nrcpts=1, msgid=<201111170935.pAH9ZoUf011838@gzpro1.guangztr.edu.cn>, relay=root@localhost
    Nov 17 17:35:50 gzpro1 sendmail[11838]: pAH9ZoUf011838: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30027, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

    求解

  9. alick 于 2011-11-17 14:11:15发表:

    引用:
    Mail submission program must have RunAsUser set to non root user

    这里说 RunAsUser 不能使 root。那就把它改成普通的服务用户。如果系统上有 postfix 用户的话,
    就应该是 postfix。

  10. 568040142 于 2011-11-17 08:57:00发表:

    2楼求解

  11. 568040142 于 2011-11-16 10:17:43发表:

    感谢AILCK的回答,现在postfix能开了,但还是不能使用mail.
    输入 echo "123" | mail -s "1" root 出现 Mail submission program must have RunAsUser set to non root user

    然后 vim /etc/mail/submit.cf 发现
    432行是
    # what user id do we assume for the majority of the processing?
    O RunAsUser=root

    451行是
    # Trusted user for file ownership and starting the daemon
    O TrustedUser=root

    该怎么改? 谢谢

  12. alick 于 2011-11-15 21:44:00发表:

    系统上sendmail服务开启了,占用了25端口。要使用postfix,先把sendmail关掉:
    临时关闭sendmail(当前有效,重启后无效):[code]service sendmail stop[/code]永久(当前无效,重启后生效):[code]chkconfig sendmail off[/code]