Chinaunix
标题:
求助,关于sendmail不能向外网发送邮件的问题????
[打印本页]
作者:
cuisir
时间:
2006-04-17 18:24
标题:
求助,关于sendmail不能向外网发送邮件的问题????
我用虚拟机做了一个sendmail服务器,然后想让这台邮件服务器给外网发邮件,比如给sina和msn或hotmail发邮件,我忘记了在那个文件里加入这些发送域的域名,默认sendmail是不给其它域发送邮件的.
我的网络模型:
客户机-------------------------------NAT服务器--------------------------外网
本机XP-----------------------------Linux--------------------------
192.168.1.30---------------------192.168.1.2/24,网关192.168.1.1,DNS,202.100.4.15
我忘记了在/etc/mail/下的那个文件里加入发送域的域名了,以前是用webmin配置的,在webmin里有一个发送域,把你想要发给那些地方的邮件的域名写进去就可以了,但我不知道具体是那个文件,比如给
123@msn.com
发送一封邮件,需要把msn.com这个域名写在那个文件里,请各位高手们指教一下
[
本帖最后由 cuisir 于 2006-4-18 23:35 编辑
]
作者:
liuziyang
时间:
2006-04-18 15:12
标题:
回复 1楼 cuisir 的帖子
relay 0.0.0.0.0
作者:
gao2000g
时间:
2006-04-18 20:48
标题:
这是我的笔记,你借签一下。
Redhat AS3+Sendmail+Openwebmail
一 Redhat Linux AS3
配置要求:
域名: gao.org
IP: 192.168.1.198
1. 配置dns ,能够正常解析gao.org域,本例:
www.gao.org
对应IP 192.168.1.198
nslookup –sil
www.gao.org
nslookup –sil 192.168.1.198
来检查正向域名配置是否有误
2. 配置:Sendmail
/etc/mail/access
gao.org (添加域名)
163.com (允许发往目的地的域名)
192.168.1 (充许 192.168.1.0 网段的用户向外发送邮件)
Fandy不受发送限制(可以无限制的发送和接收Interanl、internet的电子邮件)
修改后用make access.db 生成新的 access.db文件。
/etc/mail/local-host-names
abc.com(添加域名,收取信件的本地域名)
3. SMTP配置
/etc/mail/sendmail..cf
# SMTP daemon options
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
更改为
O DaemonPortOptions=Port=smtp,Addr=192.168.1.198, Name=MTA
修改完成后用:netstat –nl 命令查看
4. POP3 配置
RedHatLinux AS3默认安装的时候并没有安装POP/IMAP,所以你需要安装imap-2002d-2包
rpm –Uvh imap-2002d-2.i386.rpm
为了用户可以使用foxmail,outlook等软件进行收信。您需要安装imap。打开系统的pop3端口。
配置:
/etc/xinetd.d/ipop2
默认:disable=yes 改为:disable=no
/etc/xinetd.d/ipop3
默认:disable=yes 改为:disable=no
/etc/xinetd.d/ipop3
默认:disable=yes 改为:disable=no
/etc/xinetd.d/pops
默认:disable=yes 改为:disable=no
5. sendmail的性能优化
或许你会收到这样的抱怨,说是当客户端程序运行在防火墙后面的话会发生连接pop端口速度变慢. 造成这个延时的原因是你的e-mail服务器初始一个IDENT会话来确认客户端的身份.如果这个询问没有反应,那服务器就会在5秒后发出 一个超时信号.这个值可以降低到1秒,从而减少IDENT产生影响
.修改/etc/mail/sendmail.cf文件,把timeout的值改成你想要的值.
# timeouts (many of these)
#O Timeout.ident=5s
改成
O Timeout.ident=1s
到此sendmail配置基本完成。在局域网内,所有用户可以用foxmail,outlook可以在本服务器内发送邮件。
二 Openwebmail
安装必要的软件包,可以从
http://www.openwebmail.org
下载
perl-CGI-2.81-88.4.i386.rpm
perl-Compress-Zlib-1.21-RH9.i386.rpm
perl-Text-Iconv-1.2-RH80.i386.rpm
perl-suidperl-5.8.0-88.i386.rpm
MIME-Base64-3.01.tar.gz
openwebmail-2.51-1.i386.rpm
cd /var/www/cgi-bin/openwebmail
ls –l
进入openwebmail下面的etc目录进行相关配置,需要修改以下
1./var/www/cgi-bin/openwebmail /etc/openwebmail.conf
2./var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf
3./var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf
1./var/www/cgi-bin/openwebmail/etc/openwebmail.conf [只需修改3处]
releasedate 20041126
domainnames gao.org //默认是auto
auth_module auth_unix.pl
mailspooldir /var/spool/mail
ow_cgidir /var/www/cgi-bin/openwebmail
ow_cgiurl /cgi-bin/openwebmail
ow_htmldir /var/www/data/openwebmail
ow_htmlurl /data/openwebmail
logfile /var/log/openwebmail.log
修改语言为中文 将:
default_language auto
改为:
default_language zh_CN.GB2312
图标还是英文将其改为中文
将
default_iconset Default
改成:
default_iconset Cool3D.Chinese.Simplified
2./var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf [只需修改2处,把smtpserver和authpop3_server改为相应的IP]
domainnames auto
smtpserver 192.168.1..198
smtpport 25
smtpauth no
enable_pop3 yes
pop3_disallowed_servers your_server, your_server.domain
pop3_delmail_by_default yes
pop3_delmail_hidden no
pop3_usessl_by_default no
authpop3_server 192.168.1.198
authpop3_port 110
3./var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf[只需修改3处],完整的内容如下:
dbm_ext .db
dbmopen_ext .db
dbmopen_haslock yes
smtpserver 192.168.1.198 //添加SMTP服务器的IP地址
上面的文件修改完后,再运行./openwebmail-tool.pl –init执行初始化脚本
[root@AS3 openwebmail]#./openwebmail-tool.pl --init
进行初始化后,无需在Apach里发布openwebmail.
用Apache发布opwebmail
初始只能用http://服务器IP/cgi-bin/openwebmail/openwebmail.pl进行访问。
用Apache在80端口发布它,使访问时只需要输入http://服务器IP 或
http://www.gao.org
(此例的域名)来进行访问。
写一个 html文件来进行跳转,内容如下
<html>
<body onload=
"window.open('http://your_server/cgi-bin/openwebmail/openwebmail.pl','_top')">
</body>
</html>
或者用:
<html><head>
<meta http-equiv="Refresh"
content="0;URL=http://your_server/cgi-bin/openwebmail/openwebmail.pl">
</head></html>
如果希望使用 http://服务器IP/mail 或 http://域名/mail 的方式,则修改如下:
修改 /etc/http/conf/httpd.conf (最后只采用一种方式)
Redirect /mail http://域名/cgi-bin/openwebmail/openwebmail.pl
Redirect /mail
http://192.168.1.198/cgi-bin/openwebmail/openwebmail.pl
修改 /etc/httpd/conf/httpd.conf
主页发现图标找不到,想到图标目录还没有做映射再加一句,每当对Apach进行修改后,都要重新配置此项.
Alias /data "/var/www/data" //自己添加
找到此例发布的80端口,进行修改
<VirtualHost *:80>
DocumentRoot /var/www/cgi-bin /发布时填写的原始路径,可作为查找对名象
ServerName _default_:80
DirectoryIndex index.html index.htm openwebmail.html index.shtml
<Directory "/var/www/cgi-bin/">
AllowOverride None
</Directory>
改为:
<VirtualHost *:80>
DocumentRoot /var/www/cgi-bin
ServerName _default_:80
DirectoryIndex index.html index.htm openwebmail.html index.shtml
<Directory "/var/www/cgi-bin/">
AllowOverride All
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
优化 Apach
MaxClients 150 同一时间最大连接数,
ServerAdmin
gao@gao.org
改为网管的邮箱吧
Timeout 300 300秒没有反应就断开
Redhat AS4 + Sendmail +openwebmail
一 Redhat Linux AS4
配置要求:
域名: as4.org
IP: 192.168.1.199
2. 配置dns ,能够正常解析as4.org域,本例:
www.as4.org
对应IP 192.168.1.199
nslookup –sil
www.as4.org
nslookup –sil 192.168.1.199
来检查正向域名配置是否有误
2. 配置:Sendmail
/etc/mail/access
gao.org (添加域名)
163.com (允许发往目的地的域名)
192.168.1 (充许 192.168.1.0 网段的用户向外发送邮件)
Fandy不受发送限制(可以无限制的发送和接收Interanl、internet的电子邮件)
修改后用make access.db 生成新的 access.db文件。
/etc/mail/local-host-names
as4.org(添加域名,收取信件的本地域名)
3. SMTP配置
/etc/mail/sendmail..cf
# SMTP daemon options
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
更改为
O DaemonPortOptions=Port=smtp,Addr=192.168.1.198, Name=MTA
修改完成后用:netstat –nl 命令查看
3. POP3 配置
修改/etc/dovecot.conf文件
将:
#protocols = imap imap3
更改为:
protocols = imap imap3 pop3 pop3s (启动imap imap3 pop3 pop3s功能)
修改完后,用netstat –nl 进行查看
5. sendmail的性能优化
或许你会收到这样的抱怨,说是当客户端程序运行在防火墙后面的话会发生连接pop端口速度变慢. 造成这个延时的原因是你的e-mail服务器初始一个IDENT会话来确认客户端的身份.如果这个询问没有反应,那服务器就会在5秒后发出 一个超时信号.这个值可以降低到1秒,从而减少IDENT产生影响
.修改/etc/mail/sendmail.cf文件,把timeout的值改成你想要的值.
# timeouts (many of these)
#O Timeout.ident=5s
改成
O Timeout.ident=1s
到此sendmail配置基本完成。在局域网内,所有用户可以用foxmail,outlook可以在本服务器内发送邮件。
二 Openwebmail
安装必要的软件包,可以从
http://www.openwebmail.org
下载
perl-5.8.5-12.1.i386.rpm
perl-CGI-SpeedyCGI-2.22-1.2.el4.rf.i386.rpm
perl-Compress-Zlib-1.34-1.2.el4.rf.i386.rpm
perl-suidperl-5.8.5-12.1.1.i386.rpm
perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
MIME-Base64-3.01.tar.gz
openwebmail-2.51-1.i386.rpm
cd /var/www/cgi-bin/openwebmail
ls –l
进入openwebmail下面的etc目录进行相关配置,需要修改以下
1./var/www/cgi-bin/openwebmail /etc/openwebmail.conf
2./var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf
3./var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf
1./var/www/cgi-bin/openwebmail/etc/openwebmail.conf [只需修改3处]
releasedate 20041126
domainnames as4.org //默认是auto
auth_module auth_unix.pl
mailspooldir /var/spool/mail
ow_cgidir /var/www/cgi-bin/openwebmail
ow_cgiurl /cgi-bin/openwebmail
ow_htmldir /var/www/data/openwebmail
ow_htmlurl /data/openwebmail
logfile /var/log/openwebmail.log
修改语言为中文 将:
default_language en
改为:
default_language zh_CN.GB2312
图标还是英文将其改为中文
将
default_iconset Cool3D.Englist
改成:
default_iconset Cool3D.Chinese.Simplified
2./var/www/cgi-bin/openwebmail/etc/defaults/openwebmail.conf [只需修改2处,把smtpserver和authpop3_server改为相应的IP]
domainnames auto
smtpserver 192.168.1..198
smtpport 25
smtpauth no
enable_pop3 yes
pop3_disallowed_servers your_server, your_server.domain
pop3_delmail_by_default yes
pop3_delmail_hidden no
pop3_usessl_by_default no
authpop3_server 192.168.1.198
authpop3_port 110
3./var/www/cgi-bin/openwebmail/etc/defaults/dbm.conf[只需修改3处],完整的内容如下:
dbm_ext .db
dbmopen_ext .db
dbmopen_haslock yes
smtpserver 192.168.1.198 //添加SMTP服务器的IP地址
关闭系统的防火墙和SELinux
上面的文件修改完后,再运行./openwebmail-tool.pl –init执行初始化脚本
[root@AS3 openwebmail]#./openwebmail-tool.pl --init
进行初始化后,无需在Apach里发布openwebmail.
用Apache发布opwebmail
初始只能用http://服务器IP/cgi-bin/openwebmail/openwebmail.pl进行访问。
如果希望使用 http://服务器IP/mail 或 http://域名/mail 的方式,则修改如下:
修改 /etc/http/conf/httpd.conf (最后只采用一种方式)
Redirect /mail http://域名/cgi-bin/openwebmail/openwebmail.pl
Redirect /mail
http://192.168.1.198/cgi-bin/openwebmail/openwebmail.pl
用Apache在80端口发布它,使访问时只需要输入http://服务器IP 或
http://www.gao.org
(此例的域名)来进行访问。
写一个 html文件来进行跳转,内容如下
<html>
<body onload=
"window.open('http://your_server/cgi-bin/openwebmail/openwebmail.pl','_top')">
</body>
</html>
或者用:
<html><head>
<meta http-equiv="Refresh"
content="0;URL=http://your_server/cgi-bin/openwebmail/openwebmail.pl">
</head></html>
修改 /etc/httpd/conf/httpd.conf
AS4系统如果发现图标找不到,需要自己手工指定图片位置,每当对Apach进行修改后,都要重新配置此项.
Alias /data "/var/www/data" //自己手工添
作者:
cuisir
时间:
2006-04-18 23:35
哇,谢谢楼上的朋友们,好详细啊,感激的痛哭流涕。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2