linux安装java邮件服务器james 博客分类: 开源 linuxmailemail邮件james
程序员文章站
2024-03-14 22:08:41
...
由于我服务器上的sendmail不好使,而postfix安装太麻烦,我安装了james
1.下载
命令:
- wget http://mirror.bjtu.edu.cn/apache//james/server/apache-james-2.3.2.tar.gz
2.解压
命令:
- tar -zxvf apache-james-2.3.2.tar.gz
- ln -s james-2.3.2 mailserver
必须先运行一下,才能配置
命令:
- cd james-2.3.2/
- chmod +x bin/*.sh
- vi bin/run.sh #在第一行加入export JAVA_HOME=/opt/java
- bin/run.sh
命令:
- [root@dev6 james-2.3.2]# sh bin/run.sh
- Using PHOENIX_HOME: /opt/james-2.3.2
- Using PHOENIX_TMPDIR: /opt/james-2.3.2/temp
- Using JAVA_HOME: /opt/java
- Running Phoenix:
- Phoenix 4.2
- James Mail Server 2.3.2
- Remote Manager Service started plain:4555
- POP3 Service started plain:110
- SMTP Service started plain:25
- NNTP Service started plain:119
- FetchMail Disabled
4.配置
1)配置dns服务器修改/etc/resolv.conf
2)看一下自己的ip:ipconfig
3)添加mx记录
4)修改apps/james/SAR-INF/config.xml
把autodetect和autodetectIP都改为false,这样我们就可以用test.com做测试了
命令:
- <servernames autodetect="false" autodetectIP="false">
- <!-- CONFIRM? -->
- <servername>test.com</servername>
- </servernames>
打开下面的注释,否则别人就可以不用密码使用你的邮箱了
修改允许发送邮件的地址,若是想允许任何ip都可以发送邮件的话就注释掉
命令:
- <!--
- <authRequired>true</authRequired>
- -->
命令:
- <mailet match="RemoteAddrNotInNetwork=127.0.0.1,192.168.60.*" class="ToProcessor">
- <processor> relay-denied </processor>
- <notice>550 - Requested action not taken: relaying denied</notice>
- </mailet>
修改dns服务器ip
命令:
- <dnsserver>
- <servers>
- <server> 10.0.0.15 </server>
- <server> 10.0.0.22 </server>
- </servers>
- <authoritative> false </authoritative>
- </dnsserver>
命令:
- <account login="root" password="root"/>
保存后重新启动,注意若是sendmail已经启动,需要把sendmail关掉
命令:
- /opt/mailserver/bin/run.sh >> /opt/mailserver/logs/run.log 2>&1 &
命令:
- [root@dev6 opt]# netstat -npl|grep 25
- tcp 0 0 0.0.0.0:892 0.0.0.0:* LISTEN 3254/rpc.statd
- tcp 0 0 :::25 :::* LISTEN 16449/java
- udp 0 0 0.0.0.0:886 0.0.0.0:* 3254/rpc.statd
- udp 0 0 0.0.0.0:889 0.0.0.0:* 3254/rpc.statd
管理员为root,密码为root,在apps/james/SAR-INF/config.xml可以修改
命令:
- [root@dev6 opt]# telnet localhost 4555
- Trying 192.168.60.6...
- Connected to localhost (192.168.60.6).
- Escape character is '^]'.
- JAMES Remote Administration Tool 2.3.2
- Please enter your login and password
- Login id:
- root
- Password:
- root
- Welcome root. HELP for a list of commands
- adduser yifangyou testpwd1s
- User yifangyou added
- quit
- Bye
- Connection closed by foreign host.
6.测试
在你本机的hosts表里加上
发送成功
转:http://blog.chinaunix.net/uid-11121450-id-3156484.html