LinuxSir.cn,穿越时空的Linuxsir!

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

ubuntu server 下discuz 和 wordpress 程序不能用sendmail 正常发送非本地用户邮件

[复制链接]
发表于 2008-1-13 16:42:22 | 显示全部楼层 |阅读模式
Linuxsir的弟兄们,你们好。我在 Ubuntu server 7.10 下用 LAMP 搭建了一个

wordpress博客和discuz论坛,但是wordpress的评论邮件和discuz的注册用户邮件发送

都不起作用。特向各位弟兄请教。详细情况如下:

1、用sudo apt-get install sendmail mailx 直接安装,没有修改任何设置文件;

#############################################################################

##################################

2、用 mail -s "test" username@localhost < "test.txt" 能够给本地用户发送邮件,

但是用同样的命令向一般的邮件(如:username@tom.com)发送邮件却收不到;

Jan 13 11:56:40 ubuntu sendmail[9053]: My unqualified host name (ubuntu)

unknown; sleeping for retry
Jan 13 11:57:40 ubuntu sendmail[9053]: unable to qualify my own domain name

(ubuntu) -- using short name
Jan 13 11:57:40 ubuntu sendmail[9053]: m0D3vetQ009053: from=username,

size=71, class=0, nrcpts=1, msgid=<200801130357.m0D3vetQ009053@ubuntu>,

relay=username@localhost
Jan 13 11:57:40 ubuntu sm-mta[9054]: m0D3vei3009054: from=<username@ubuntu>,

size=326, class=0, nrcpts=1, msgid=<200801130357.m0D3vetQ009053@ubuntu>,

proto=ESMTP, daemon=MSP-v4, relay=localhost [127.0.0.1]
Jan 13 11:57:40 ubuntu sendmail[9053]: m0D3vetQ009053: to=username@tom.com,

ctladdr=username (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay,

pri=30071, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent

(m0D3vei3009054 Message accepted for delivery)
Jan 13 11:57:46 ubuntu sm-mta[9056]: m0D3vei3009054: to=<username@tom.com>,

ctladdr=<username@ubuntu> (1000/1000), delay=00:00:06, xdelay=00:00:06,

mailer=esmtp, pri=120326, relay=tommx.163.net. [218.30.111.181], dsn=5.0.0,

stat=Service unavailable
Jan 13 11:57:46 ubuntu sm-mta[9056]: m0D3vei3009054: m0D3vki3009056: DSN:

Service unavailable
Jan 13 11:57:46 ubuntu sm-mta[9056]: m0D3vki3009056: to=<username@ubuntu>,

delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30000, dsn=2.0.0,

stat=Sent
Jan 13 12:00:01 ubuntu sm-msp-queue[9090]: My unqualified host name (ubuntu)

unknown; sleeping for retry


然后,系统给本地用户发了一封邮件,用mail读取内容如下:

Message 1:
From MAILER-DAEMON  Sun Jan 13 11:57:46 2008
Date: Sun, 13 Jan 2008 11:57:46 +0800
From: Mail Delivery Subsystem <MAILER-DAEMON>
To: <username@ubuntu>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="m0D3vki3009056.1200196666/ubuntu"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

--m0D3vki3009056.1200196666/ubuntu

The original message was received at Sun, 13 Jan 2008 11:57:40 +0800
from localhost [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----
<username@tom.com>
    (reason: 451 4.4.1 reply: read error from tommx.163.net.)

   ----- Transcript of session follows -----
... while talking to tommx.163.net.:
>>> DATA
<<< 553 this mail is blocked by kbas

system,blockid=cnmx11.tom.com.9466.1200196655
451 4.4.1 reply: read error from tommx.163.net.
554 5.0.0 Service unavailable

--m0D3vki3009056.1200196666/ubuntu
Content-Type: message/delivery-status

Reporting-MTA: dns; ubuntu
Received-From-MTA: DNS; localhost
Arrival-Date: Sun, 13 Jan 2008 11:57:40 +0800

Final-Recipient: RFC822; username@tom.com
Action: failed
Status: 4.4.2
Remote-MTA: DNS; tommx.163.net
Diagnostic-Code: SMTP; 451 4.4.1 reply: read error from tommx.163.net.
Last-Attempt-Date: Sun, 13 Jan 2008 11:57:46 +0800

--m0D3vki3009056.1200196666/ubuntu
Content-Type: text/rfc822-headers

Return-Path: <username@ubuntu>
Received: from ubuntu (localhost [127.0.0.1])
        by ubuntu (8.14.1/8.14.1/Debian-8ubuntu1) with ESMTP id

m0D3vei3009054
        for <username@tom.com>; Sun, 13 Jan 2008 11:57:40 +0800
Received: (from username@localhost)
        by ubuntu (8.14.1/8.14.1/Submit) id m0D3vetQ009053
        for username@tom.com; Sun, 13 Jan 2008 11:57:40 +0800
Date: Sun, 13 Jan 2008 11:57:40 +0800
From: username <username@ubuntu>
Message-Id: <200801130357.m0D3vetQ009053@ubuntu>
To: username@tom.com
Subject: test 20080112

--m0D3vki3009056.1200196666/ubuntu--


#############################################################################

##################################

3、昨天wordpress自动发送邮件的系统反馈邮件:

From MAILER-DAEMON  Sat Jan 12 22:26:27 2008
Return-Path: <MAILER-DAEMON>
Received: from localhost (localhost)
        by ubuntu (8.14.1/8.14.1/Debian-8ubuntu1) id m0CEQR0h006882;
        Sat, 12 Jan 2008 22:26:27 +0800
Date: Sat, 12 Jan 2008 22:26:27 +0800
From: Mail Delivery Subsystem <MAILER-DAEMON>
Message-Id: <200801121426.m0CEQR0h006882@ubuntu>
To: <www-data@ubuntu>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="m0CEQR0h006882.1200147987/ubuntu"
Content-Transfer-Encoding: 8bit
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
Status: RO

This is a MIME-encapsulated message

--m0CEQR0h006882.1200147987/ubuntu

The original message was received at Sat, 12 Jan 2008 22:26:25 +0800
from localhost [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----
<username@tom.com>
    (reason: 451 4.4.1 reply: read error from tommx.163.net.)

   ----- Transcript of session follows -----
... while talking to tommx.163.net.:
>>> DATA
<<< 553 this mail is blocked by kbas

system,blockid=cnmx22.tom.com.24669.1200147982
451 4.4.1 reply: read error from tommx.163.net.
554 5.0.0 Service unavailable

--m0CEQR0h006882.1200147987/ubuntu
Content-Type: message/delivery-status

Reporting-MTA: dns; ubuntu
Received-From-MTA: DNS; localhost
Arrival-Date: Sat, 12 Jan 2008 22:26:25 +0800

Final-Recipient: RFC822; username@tom.com
Action: failed
Status: 4.4.2
Remote-MTA: DNS; tommx.163.net
Diagnostic-Code: SMTP; 451 4.4.1 reply: read error from tommx.163.net.
Last-Attempt-Date: Sat, 12 Jan 2008 22:26:27 +0800

--m0CEQR0h006882.1200147987/ubuntu
Content-Type: text/rfc822-headers
Content-Transfer-Encoding: 8bit

Return-Path: <www-data@ubuntu>
Received: from ubuntu (localhost [127.0.0.1])
        by ubuntu (8.14.1/8.14.1/Debian-8ubuntu1) with ESMTP id

m0CEQP0h006880
        for <username@tom.com>; Sat, 12 Jan 2008 22:26:25 +0800
Received: (from www-data@localhost)
        by ubuntu (8.14.1/8.14.1/Submit) id m0CEQPiY006863;
        Sat, 12 Jan 2008 22:26:25 +0800
To: username@tom.com
Subject: =?UTF-8?B?

W+S6muiZjuenkeaKgF0g6K+35a6h5p+lIuWlveeUqFNTSCB3aW5kb3dzIOWu?=  =?UTF-8?B?

ouaIt+err+W3peWFt+WPiiDljZrlrqLova/ku7Yi?=
Date: Sat, 12 Jan 2008 22:25:25 +0800
From: "wordpress@shehongren.net" <wordpress@shehongren.net>
Message-ID: <a0faf65eca123f5a0b0c26a07d3b4031@www.shehongren.net>
X-Priority: 3
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="UTF-8"

--m0CEQR0h006882.1200147987/ubuntu--

#############################################################################

##################################

4、我的 /etc/sendmail.mc 文件内容:

divert(-1)dnl
#---------------------------------------------------------------------------

--
# $Sendmail: debproto.mc,v 8.14.1 2007-08-01 05:06:30 cowboy Exp $
#
# Copyright (c) 1998-2007 Richard Nelson.  All Rights Reserved.
#
# cf/debian/sendmail.mc.  Generated from sendmail.mc.in by configure.
#
# sendmail.mc prototype config file for building Sendmail 8.14.1
#
# Note: the .in file supports 8.7.6 - 9.0.0, but the generated
#        file is customized to the version noted above.
#
# This file is used to configure Sendmail for use with Debian systems.
#
# If you modify this file, you will have to regenerate /etc/mail/sendmail.cf
# by running this file through the m4 preprocessor via one of the following:
#        * `sendmailconfig`
#        * `make`
#        * `m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf`
# The first two options are preferred as they will also update other files
# that depend upon the contents of this file.
#
# The best documentation for this .mc file is:
# /usr/share/doc/sendmail-doc/cf.README.gz
#
#---------------------------------------------------------------------------

--
divert(0)dnl
#
#   Copyright (c) 1998-2005 Richard Nelson.  All Rights Reserved.
#
#  This file is used to configure Sendmail for use with Debian systems.
#
define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`$Id: sendmail.mc, v 8.14.1-8ubuntu1 2007-08-01 05:06:30 cowboy Exp

$')
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
undefine(`confHOST_STATUS_DIRECTORY')dnl        #DAEMON_HOSTSTATS=
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
dnl #
dnl # General defines
dnl #
dnl # SAFE_FILE_ENV: [undefined] If set, sendmail will do a chroot()
dnl #        into this directory before writing files.
dnl #        If *all* your user accounts are under /home then use that
dnl #        instead - it will prevent any writes outside of /home !
dnl #   define(`confSAFE_FILE_ENV',             `')dnl
dnl #
dnl # Daemon options - restrict to servicing LOCALHOST ONLY !!!
dnl # Remove `, Addr=' clauses to receive from any interface
dnl # If you want to support IPv6, switch the commented/uncommentd lines
FEATURE(`no_default_msa')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, Addr=127.0.0.1')

dnl
dnl #
dnl # Be somewhat anal in what we allow
define(`confPRIVACY_FLAGS',dnl
`needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyret

urn,authwarnings')dnl
dnl #
dnl # Define connection throttling and window length
define(`confCONNECTION_RATE_THROTTLE', `15')dnl
define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl
dnl #
dnl # Features
dnl #
dnl # The access db is the basis for most of sendmail's checking
FEATURE(`access_db', , `skip')dnl
dnl #
dnl # The greet_pause feature stops some automail bots - but check the
dnl # provided access db for details on excluding localhosts...
FEATURE(`greet_pause', `1000')dnl 1 seconds
dnl #
dnl # Delay_checks allows sender<->recipient checking
FEATURE(`delay_checks', `friend', `n')dnl
dnl #
dnl # If we get too many bad recipients, slow things down...
define(`confBAD_RCPT_THROTTLE',`3')dnl
dnl #
dnl # Stop connections that overflow our concurrent and time connection rates
FEATURE(`conncontrol', `nodelay', `terminate')dnl
FEATURE(`ratecontrol', `nodelay', `terminate')dnl
dnl #
dnl # If you're on a dialup link, you should enable this - so sendmail
dnl # will not bring up the link (it will queue mail for later)
dnl define(`confCON_EXPENSIVE',`True')dnl
dnl #
dnl # Dialup/LAN connection overrides
dnl #
include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl
dnl #
dnl # Default Mailer setup
MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl

##########################################################################

5、nmap localhost 的结果为:
Starting Nmap 4.20 ( http://insecure.org ) at 2008-01-13 16:23 CST
Interesting ports on localhost (127.0.0.1):
Not shown: 1692 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
25/tcp   open  smtp
80/tcp   open  http
587/tcp  open  submission
3306/tcp open  mysql

Nmap finished: 1 IP address (1 host up) scanned in 0.220 seconds
********************************************************************

nmap www.shehongren.net 的结果为:

Interesting ports on 222.214.236.61:
Not shown: 1695 filtered ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Nmap finished: 1 IP address (1 host up) scanned in 38.908 seconds

*********************************************************************
netstat -a 相关的结果为:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 localhost:mysql         *:*                     LISTEN
tcp        0      0 localhost:submission    *:*                     LISTEN
tcp        0      0 *:smtp                  *:*                     LISTEN

####################################################################

6、我觉得可能是tom.com 认为我们发的邮件是垃圾邮件给屏蔽了,但是我们的IP是才用

的,不应该进入他们的黑名单。

我怎样才能使网站的wordpress 博客和 discuz 论坛的系统邮件发送功能正常呢?只需

要能够正常发送这些程序的通知邮件。不必成为一个全功能的邮件服务器。

谢谢。
发表于 2008-1-13 20:52:38 | 显示全部楼层
大站一般会对接到的信件做DNS反解,不成功就不接受。参考
http://bbs.5dmail.net/thread-8907-1-1.html
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-14 10:47:53 | 显示全部楼层
谢谢 ccan30 ,您介绍的文章很详细。我试试看看。如果确认我的 sendmail 配置没有错的话,我试试域名设置。
回复 支持 反对

使用道具 举报

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

本版积分规则

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