邮件不能发送

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
zygao56
帖子: 7
注册时间: 2008-02-26 9:52

邮件不能发送

#1

帖子 zygao56 » 2008-02-26 10:12

我想在软件里用mail()命令发送邮件, 选用 ubuntu 7.10, 安装好 后,邮件一直不能工作。重装了 sendmail 多次,仍不管用, 装上 Thanderbird, 配置后可以对外收发邮件,但本地邮件仍不能用。 试着装 postfix 仍是无法 收发 local 邮件。急死人了! 请教高手, 如何解决?, :oops:
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#2

帖子 oneleaf » 2008-02-26 10:17

"收发 local 邮件" 什么意思?
直接采用 telnet 127.0.0.1 25 测试是否正常。
zygao56
帖子: 7
注册时间: 2008-02-26 9:52

#3

帖子 zygao56 » 2008-02-26 14:45

谢谢。 我的机器装成服务器,本地用户间的邮件通讯及本地向外部如hotmail的邮件不通。
telnet 测试好像正常:

$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 ccitv-web ESMTP Sendmail 8.14.1/8.14.1/Debian-8ubuntu1; Mon, 25 Feb 2008 22:30:47 -0800; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
ehlo localhost
250-ccitv-web Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP


错误信息: /var/log/mail.err

Feb 25 13:20:42 cc-web sendmail[19093]: unable to qualify my own domain name (cc-web) -- using short name
Feb 25 13:21:01 cc-web sm-msp-queue[19109]: unable to qualify my own domain name (cc-web) -- using short name
Feb 25 13:40:01 cc-web sm-msp-queue[19169]: My unqualified host name (cc-web) unknown; sleeping for retry

Feb 25 15:27:59 cc-web postfix/postfix-script[21123]: fatal: usage: postfix start (or stop, reload, abort, flush, check, set-permissions, upgrade-configuration)

Feb 25 15:28:31 cc-web postfix/postfix-script[21128]: fatal: the Postfix mail system is not running
Feb 25 15:28:38 cc-web postfix/master[21201]: fatal: bind 127.0.0.1 port 25: Address already in use


好像端口25被别的占用了。
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#4

帖子 oneleaf » 2008-02-26 14:49

在新立德删除 Sendmail ,重启 postfix 。
zygao56
帖子: 7
注册时间: 2008-02-26 9:52

#5

帖子 zygao56 » 2008-02-26 15:03

我试了 apt-get autoremove sendmail 然后重起postfix, 但 还有错误:
Feb 25 23:00:51 ccitv-web postfix/master[22903]: fatal: bind 127.0.0.1 port 25: Address already in use
还有,在安装postfix时配置参数选了local mail, thunderbird 里的outgoing server (SMTP) setting里有 端口25
不知有没有影响。
ygf
帖子: 458
注册时间: 2006-11-27 12:25

#6

帖子 ygf » 2008-02-26 21:59

1、将你的服务器主机名设置成和你的邮件域名一样(比如说都是abc.net)。再试一下。我配置postfix时也遇到这种问题,就是这样解决的。

2、如果你使用了动态域名服务(比如花生壳),那么一些公众邮件服务器比如hotmail.com,gmail.com,163.com等等会拒收邮件的,这是为了防止垃圾邮件而设的。
zygao56
帖子: 7
注册时间: 2008-02-26 9:52

#7

帖子 zygao56 » 2008-02-27 0:29

谢谢。 我再试一试。
zygao56
帖子: 7
注册时间: 2008-02-26 9:52

#8

帖子 zygao56 » 2008-03-02 1:59

不好意思,问题还是没有很好解决。我觉得我的postfix 的 main.cf文件 有问题,同时服务器的域名,邮件地址等设置也有问题。我把postfix 卸掉,只试sendmail , 重新安装配置,现在是用sendmail 可以发送邮件到本地用户(在/var/mail/ 下文件中可以看到),但hotmail 等外部邮件反倒是泥牛入海,我一会把配置文件贴出来,请高手帮我 诊断诊断, 先谢了。
对了,先请教:如何查看邮件?
:roll:
zygao56
帖子: 7
注册时间: 2008-02-26 9:52

邮件发送失败及相关的配置信息

#9

帖子 zygao56 » 2008-03-02 5:29

Sendmail 启动及 发送邮件 到 tony_gy@hotmail.com 的 log 片段:
tail /var/log/mail.log: ***********************************************************************************
...
Mar 1 12:48:07 ccitv-web sm-mta[5717]: starting daemon (8.14.1): SMTP+queueing@00:10:00
Mar 1 12:48:09 ccitv-web dovecot: Dovecot v1.0.5 starting up
Mar 1 12:50:27 ccitv-web sendmail[6355]: m21Kns0t006355: from=ccitv, size=50, class=0, nrcpts=1, msgid=<200803012049.m21Kns0t006355@ccitv-web.org>, relay=ccitv@localhost

Mar 1 12:50:27 ccitv-web sm-mta[6356]: m21KoRWH006356: from=<ccitv@ccitv-web.org>, size=356, class=0, nrcpts=1, msgid=<200803012049.m21Kns0t006355@ccitv-web.org>, proto=ESMTP, daemon=MSP-v4, relay=localhost [127.0.0.1]

Mar 1 12:50:27 ccitv-web sendmail[6355]: m21Kns0t006355: to=tony_gy@hotmail.com, ctladdr=ccitv (1000/1000), delay=00:00:33, xdelay=00:00:00, mailer=relay, pri=30050, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m21KoRWH006356 Message accepted for delivery)

Mar 1 12:50:53 ccitv-web sm-mta[6361]: m21Koe1p006361: ccitv-web.org [192.168.8.101] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA-v4

服务器配置:

ifconfig :********************************************************
eth0 链路封装:以太网 硬件地址 00:1A:92:CB:7E:F4
inet 地址:192.168.8.101 广播:192.168.8.255 掩码:255.255.255.0
inet6 地址: fe80::21a:92ff:fecb:7ef4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:1003 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:1009 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:1025341 (1001.3 KB) 发送字节:177598 (173.4 KB)
中断:22 基本地址:0xc000

lo 链路封装:本地环回
inet 地址:127.0.0.1 掩码:255.0.0.0
inet6 地址: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 跃点数:1
接收数据包:188 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:188 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:0
接收字节:24955 (24.3 KB) 发送字节:24955 (24.3 KB)

$ cat /etc/hosts ***********************************************************
127.0.0.1 localhost
192.168.8.101 ccitv-web.org ccitv.ccitv-web.org ccitv-web ccitv cc-web
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

~$ cat /etc/host.conf ****************************************************
# The "order" line is only used by old versions of the C library.
order hosts,bind
multi on



$ ls /etc/bind/named.conf **********************************************************
/etc/bind/named.conf
ccitv@ccitv-web:~$ cat /etc/bind/named.conf
include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};

zone "localhost" {
type master;
file "/etc/bind/db.local";
};

zone "ccitv-web" {
type master;
notify no;
allow-query { any; };
file "/etc/bind/db.127";
};

zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};

include "/etc/bind/named.conf.local";




$cat /etc/networks *****************************************************
# symbolic names for networks, see networks(5) for more information
link-local 169.254.0.0
localhost 192.168.8.101
lo 127.0.0.1


~$ cat /etc/network/interfaces **********************************
auto eth0
iface lo inet loopback
iface eth0 inet static
address 192.168.8.101
netmask 255.255.255.0
network 192.168.8.0
broadcast 192.168.8.255
gateway 192.168.8.1

$ sudo cat /etc/mail/access

localhost RELAY
192.168 RELAY
127.0.0.1 RELAY
hotmail.com RELAY
yahoo.com RELAY
gmail.com RELAY
yahoo.ca RELAY

GreetPause:localhost 0
ClientRate:localhost 0
ClientConn:localhost 0
Connect:127 RELAY
GreetPause:127 0
ClientRate:127 0
ClientConn:127 0
Connect:[IPv6:::1] RELAY
GreetPause:[IPv6:::1] 0
ClientRate:[IPv6:::1] 0
ClientConn:[IPv6:::1] 0
#Connect:192.168 RELAY
#GreetPause:192.168 0
#ClientRate:192.168 0
#ClientConn:192.168 0
# Defaults
GreetPause: 5000
ClientRate: 10
ClientConn: 10
Spam:postmaster@ FRIEND
Spam:abuse@ FRIEND
Spam:spam@ FRIEND

reject@ REJECT
# Block invalid IPs
Connect:0 REJECT
Connect:169.254 REJECT
Connect:192.0.2 REJECT
Connect:224 REJECT
Connect:255 REJECT



~$ sudo cat /etc/mail/sendmail.mc
divert(-1)dnl
#-----------------------------------------------------------------------------
divert(0)dnl

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=

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=0.0.0.0')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission')dnl

dnl # Stop connections that overflow our concurrent and time connection rates
FEATURE(`conncontrol', `nodelay', `terminate')dnl
FEATURE(`ratecontrol', `nodelay', `terminate')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
zygao56
帖子: 7
注册时间: 2008-02-26 9:52

补充

#10

帖子 zygao56 » 2008-03-02 5:32

我的服务器现在是通过路由器上网的,没有对外的IP地址。
回复