linux安装java邮件服务器james

由于我服务器上的sendmail不好使,而postfix安装太麻烦,我安装了james
1.下载

命令:

  1. wget http://mirror.bjtu.edu.cn/apache//james/server/apache-james-2.3.2.tar.gz

2.解压


命令:

  1. tar -zxvf apache-james-2.3.2.tar.gz
  2. ln -s james-2.3.2 mailserver
3.运行
必须先运行一下,才能配置

命令:

  1. cd james-2.3.2/
  2. chmod +x bin/*.sh
  3. vi bin/run.sh #在第一行加入export JAVA_HOME=/opt/java
  4. bin/run.sh

命令:

  1. [root@dev6 james-2.3.2]# sh bin/run.sh
  2. Using PHOENIX_HOME: /opt/james-2.3.2
  3. Using PHOENIX_TMPDIR: /opt/james-2.3.2/temp
  4. Using JAVA_HOME: /opt/java
  5. Running Phoenix:
  6. Phoenix 4.2
  7. James Mail Server 2.3.2
  8. Remote Manager Service started plain:4555
  9. POP3 Service started plain:110
  10. SMTP Service started plain:25
  11. NNTP Service started plain:119
  12. FetchMail Disabled
ctrl+c 后这时apps/下多了一个james的目录
4.配置
1)配置dns服务器修改/etc/resolv.conf
2)看一下自己的ip:ipconfig
3)添加mx记录
4)修改apps/james/SAR-INF/config.xml
   

把autodetect和autodetectIP都改为false,这样我们就可以用test.com做测试了

命令:

  1. <servernames autodetect="false" autodetectIP="false">
  2. <!-- CONFIRM? -->
  3. <servername>test.com</servername>
  4. </servernames>
打开下面的注释,否则别人就可以不用密码使用你的邮箱了

命令:

  1. <!--
  2. <authRequired>true</authRequired>
  3. -->
修改允许发送邮件的地址,若是想允许任何ip都可以发送邮件的话就注释掉

命令:

  1. <mailet match="RemoteAddrNotInNetwork=127.0.0.1,192.168.60.*" class="ToProcessor">
  2. <processor> relay-denied </processor>
  3. <notice>550 - Requested action not taken: relaying denied</notice>
  4. </mailet>
 

修改dns服务器ip

扫描二维码关注公众号,回复: 671495 查看本文章

命令:

  1. <dnsserver>
  2. <servers>
  3. <server> 10.0.0.15 </server>
  4. <server> 10.0.0.22 </server>
  5. </servers>
  6. <authoritative> false </authoritative>
  7. </dnsserver>
修改管理员用户名和密码:

命令:

  1. <account login="root" password="root"/>

 
保存后重新启动,注意若是sendmail已经启动,需要把sendmail关掉

命令:

  1. /opt/mailserver/bin/run.sh >> /opt/mailserver/logs/run.log 2>&1 &
看一下25端口

命令:

  1. [root@dev6 opt]# netstat -npl|grep 25
  2. tcp 0 0 0.0.0.0:892 0.0.0.0:* LISTEN 3254/rpc.statd
  3. tcp 0 0 :::25 :::* LISTEN 16449/java
  4. udp 0 0 0.0.0.0:886 0.0.0.0:* 3254/rpc.statd
  5. udp 0 0 0.0.0.0:889 0.0.0.0:* 3254/rpc.statd
5.创建用户
管理员为root,密码为root,在apps/james/SAR-INF/config.xml可以修改

命令:

  1. [root@dev6 opt]# telnet localhost 4555
  2. Trying 192.168.60.6...
  3. Connected to localhost (192.168.60.6).
  4. Escape character is '^]'.
  5. JAMES Remote Administration Tool 2.3.2
  6. Please enter your login and password
  7. Login id:
  8. root
  9. Password:
  10. root
  11. Welcome root. HELP for a list of commands
  12. adduser yifangyou testpwd1s
  13. User yifangyou added
  14. quit
  15. Bye
  16. Connection closed by foreign host.
6.测试
在你本机的hosts表里加上

命令:

  1. 192.168.60.6 test.com
发送成功
转: http://blog.chinaunix.net/uid-11121450-id-3156484.html

猜你喜欢

转载自mazhen20073492.iteye.com/blog/1990258