LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1044|回复: 6

++++++++请教用sendmail针对IP地址收发邮件的问题

[复制链接]
发表于 2005-12-9 21:05:16 | 显示全部楼层 |阅读模式
先谢谢了.请指点一把

两台连接公网的AS4+sendmail,用域名向对方收发邮件正常,即
1. 在aaa.com.cn上向bbb.com.cn发邮件成功,bbb.com.cn也可成功接收
[aaa]#mail  test@bbb.com.cn

2. 在bbb.com.cn上向aaa.com.cn发邮件成功,aaa.com.cn也可成功接收
[bbb]#mail  test@aaa.com.cn

但是,若将上述邮箱地址中的域名换为IP地址,则两机向对方发送邮件都失败,即
1. 在aaa.com.cn上向bbb.com.cn的对应IP地址发送邮件失败.
[aaa]#mail test@[218.76.51.2]     -----bbb.com.cn的IP

2.在bbb.com.cn上向aaa.com.cn的对应IP地址发送邮件也失败.
[bbb]#mail test@[218.76.51.1]     -----aaa.com.cn的IP

IP地址前后不加[ ]也不行.双方ping 对方IP都能ping 通,双方防火墙均已关闭,双方的/etc/mail/local-host-name文件中都已加入了自己的ip地址(也试过不加),双方的access.db中都已加入对方的IP并允许RELAY(也试过不加).

以下是其中一方发送邮件后的失败信息,我已用[]指定了用IP地址发送邮件,为什么还会用DNS解析并出现MX problem呢?
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N  1 MAILER-DAEMON@localh  Fri Dec  9 22:30  64/2377  "Returned mail: see tr"
& Message 1:
From MAILER-DAEMON@localhost.localdomain  Fri Dec  9 22:30:32 2005
Date: Fri, 9 Dec 2005 22:30:32 -0500
From: Mail Delivery Subsystem <MAILER-DAEMON@localhost.localdomain>
To: postmaster@localhost.localdomain
To: <root@localhost.localdomain>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="jBA3UWk0002972.1134185432/localhost.localdomain"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

--jBA3UWk0002972.1134185432/localhost.localdomain

The original message was received at Fri, 9 Dec 2005 22:30:31 -0500
from localhost.localdomain [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----
<test@[218.76.51.1]>
    (reason: 553 5.3.5 system config error)

   ----- Transcript of session follows -----
553 5.3.5 [218.76.51.1] config error: mail loops back to me (MX problem?)
554 5.3.5 Local configuration error

--jBA3UWk0002972.1134185432/localhost.localdomain
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Received-From-MTA: DNS; localhost.localdomain
Arrival-Date: Fri, 9 Dec 2005 22:30:31 -0500

Final-Recipient: RFC822; test@[218.76.51.1]
Action: failed
Status: 5.3.5
Diagnostic-Code: SMTP; 553 5.3.5 system config error
Last-Attempt-Date: Fri, 9 Dec 2005 22:30:32 -0500

--jBA3UWk0002972.1134185432/localhost.localdomain
Content-Type: message/rfc822

Return-Path: <root@localhost.localdomain>
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
        by localhost.localdomain (8.13.1/8.13.1) with ESMTP id jBA3UVk0002970
        for <test@[218.76.51.1]>; Fri, 9 Dec 2005 22:30:31 -0500
Received: (from root@localhost)
        by localhost.localdomain (8.13.1/8.13.1/Submit) id jBA3UVRI002969
        for test@[218.76.51.1]; Fri, 9 Dec 2005 22:30:31 -0500
Date: Fri, 9 Dec 2005 22:30:31 -0500
From: root <root@localhost.localdomain>
Message-Id: <200512100330.jBA3UVRI002969@localhost.localdomain>
To: test@[218.76.51.1]
Subject: &&&&&&&&&&&&&

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

--jBA3UWk0002972.1134185432/localhost.localdomain--

&
 楼主| 发表于 2005-12-15 08:25:05 | 显示全部楼层
不好意思,顶一个...求助
回复 支持 反对

使用道具 举报

发表于 2005-12-15 08:54:01 | 显示全部楼层
“553 5.3.5 [218.76.51.1] config error: mail loops back to me (MX problem?)
554 5.3.5 Local configuration error”这种错误一般是MX或者RELAY配置出了问题,在测试中也发现过同样的问题,您用的是RPM 还是TAR?请说清楚:-)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-12-15 19:27:03 | 显示全部楼层
谢谢.

我用的是AS4自带的sendmail,没用rpm也没用tar.

我用域名收发邮件是正常的,但用IP地址收发就有问题了.应该和MX没关系吧...
回复 支持 反对

使用道具 举报

发表于 2005-12-16 09:58:06 | 显示全部楼层
把你的sendmail.mc贴上来看看
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-12-16 14:43:04 | 显示全部楼层
谢谢关注
以下为sendmail.mc的内容

divert(-1)dnl
dnl #
dnl # This is the sendmail macro config file for m4. If you make changes to
dnl # /etc/mail/sendmail.mc, you will need to regenerate the
dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is
dnl # installed and then performing a
dnl #
dnl #     make -C /etc/mail
dnl #
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for Red Hat Linux')dnl
OSTYPE(`linux')dnl
dnl #
dnl # default logging level is 9, you might want to set it higher to
dnl # debug the configuration
dnl #
dnl define(`confLOG_LEVEL', `9')dnl
dnl #
dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
dnl define(`SMART_HOST',`smtp.your.provider')
dnl #
define(`confDEF_USER_ID',``8:12'')dnl
dnl define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST',true)dnl
define(`confDONT_PROBE_INTERFACES',true)dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
dnl #
dnl # The following allows relaying if the user authenticates, and disallows
dnl # plaintext authentication (PLAIN/LOGIN) on non-TLS links
dnl #
dnl define(`confAUTH_OPTIONS', `A p')dnl
dnl #
dnl # PLAIN is the preferred plaintext authentication method and used by
dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do
dnl # use LOGIN. Other mechanisms should be used if the connection is not
dnl # guaranteed secure.
dnl # Please remember that saslauthd needs to be running for AUTH.
dnl #
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl #
dnl # Rudimentary information on creating certificates for sendmail TLS:
dnl #     cd /usr/share/ssl/certs; make sendmail.pem
dnl # Complete usage:
dnl #     make -C /usr/share/ssl/certs usage
dnl #
dnl define(`confCACERT_PATH',`/usr/share/ssl/certs')
dnl define(`confCACERT',`/usr/share/ssl/certs/ca-bundle.crt')
dnl define(`confSERVER_CERT',`/usr/share/ssl/certs/sendmail.pem')
dnl define(`confSERVER_KEY',`/usr/share/ssl/certs/sendmail.pem')
dnl #
dnl # This allows sendmail to use a keyfile that is shared with OpenLDAP's
dnl # slapd, which requires the file to be readble by group ldap
dnl #
dnl define(`confDONT_BLAME_SENDMAIL',`groupreadablekeyfile')dnl
dnl #
dnl define(`confTO_QUEUEWARN', `4h')dnl
dnl define(`confTO_QUEUERETURN', `5d')dnl
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
define(`confTO_IDENT', `0')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa',`dnl')dnl
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
dnl #
dnl # The following limits the number of processes sendmail can fork to accept
dnl # incoming messages or process its message queues to 12.) sendmail refuses
dnl # to accept connections once it has reached its quota of child processes.
dnl #
dnl define(`confMAX_DAEMON_CHILDREN', 12)dnl
dnl #
dnl # Limits the number of new connections per second. This caps the overhead
dnl # incurred due to forking new sendmail processes. May be useful against
dnl # DoS attacks or barrages of spam. (As mentioned below, a per-IP address
dnl # limit would be useful but is not available as an option at this writing.)
dnl #
dnl define(`confCONNECTION_RATE_THROTTLE', 3)dnl
dnl #
dnl # The -t option will retry delivery if e.g. the user runs over his quota.
dnl #
FEATURE(local_procmail,`',`procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db',`hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
dnl #
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 587 for
dnl # mail from MUAs that authenticate. Roaming users who can't reach their
dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
dnl # this useful.
dnl #
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 465, but
dnl # starting immediately in TLS mode upon connecting. Port 25 or 587 followed
dnl # by STARTTLS is preferred, but roaming clients using Outlook Express can't
dnl # do STARTTLS on ports other than 25. Mozilla Mail can ONLY use STARTTLS
dnl # and doesn't support the deprecated smtps; Evolution <1.1.1 uses smtps
dnl # when SSL is enabled-- STARTTLS support is available in version 1.1.1.
dnl #
dnl # For this to work your OpenSSL certificates must be configured.
dnl #
dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
dnl #
dnl # The following causes sendmail to additionally listen on the IPv6 loopback
dnl # device. Remove the loopback address restriction listen to the network.
dnl #
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
dnl #
dnl # enable both ipv6 and ipv4 in sendmail:
dnl #
dnl DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Name=MTA-v6, Family=inet6')
dnl #
dnl # We strongly recommend not accepting unresolvable domains if you want to
dnl # protect yourself from spam. However, the laptop and users on computers
dnl # that do not have 24x7 DNS do need this.
dnl #
dnl FEATURE(`accept_unresolvable_domains')dnl
dnl #
dnl FEATURE(`relay_based_on_MX')dnl
dnl #
dnl # Also accept email sent to "localhost.localdomain" as local email.
dnl #
LOCAL_DOMAIN(`localhost.localdomain')dnl
dnl #
dnl # The following example makes mail from this host and any additional
dnl # specified domains appear to be sent from mydomain.com
dnl #
dnl MASQUERADE_AS(`mydomain.com')dnl
dnl #
dnl # masquerade not just the headers, but the envelope as well
dnl #
dnl FEATURE(masquerade_envelope)dnl
dnl #
dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well
dnl #
dnl FEATURE(masquerade_entire_domain)dnl
dnl #
dnl MASQUERADE_DOMAIN(localhost)dnl
dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
回复 支持 反对

使用道具 举报

发表于 2005-12-20 09:33:23 | 显示全部楼层
呵呵,恩!dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
dnl #
dnl # The following causes sendmail to additionally listen to port 587 for
dnl # mail from MUAs that authenticate. Roaming users who can't reach their
dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
dnl # this useful.
这个里面的127.0.0.1如果你不改成自己的IP的话是不是不可以啊:-)
试试看:-)
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表