转载 

Apache James 3.3.0 搭建外网邮箱服务器

分类:运维    650人阅读    IT小君  2022-10-05 21:47
  • 准备域名

  比如域名为 example.net,则邮箱格式为 [email protected]。在自己的域名管理界面,添加一条 A 记录(mail.example.net  xxx.xxx.xxx.xxx),指向服务器公共 IP 地址;再添加一条 MX 记录(空,mail.example.net)。若没有域名,无法收发外网邮件。

  如果只需要在内网收发邮件,可以在 C:\Windows\System32\drivers\etc 目录下的 host 文件中,添加一条记录(本机 IP example.net)来充当域名。

  • 下载 apache james 3.3.0,解压后,目录如下图所示

  

  • 配置 james

  进入 conf 目录

  domainlist.xml,将相应位置内容修改为

<domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
  <autodetect>false</autodetect>
  <autodetectIP>false</autodetectIP>
  <defaultDomain>example.net</defaultDomain>
</domainlist>

  mailetcontainer.xml,将相应位置的内容修改为

<context>
  <postmaster>[email protected]</postmaster>
</context>

smtpserver.xml,将相应位置内容修改为

<helloName autodetect="true">example.net</helloName>

  • 启动 james

由于 james 需要 java 运行环境,所以需要提交安装 jdk 1.7 及以上版本

进入 bin 目录,用命令窗口启动 run.bat 文件

  • 添加邮箱账号

james-cli.bat -h localhost -p 9999 adddomain example.net
james-cli.bat -h localhost -p 9999 adduser [email protected] 111111

执行后,即添加了一个邮箱账号 [email protected],密码为 111111

  • 用 foxmail 测试

安装 foxmail 后,右上角菜单 - 账号管理 - 账号 - 新建 - 手动设置,信息如下所示,其中 POP 服务器、SMTP 服务器均填写之前配置的域名 mail.example.net

 

 

附上 apache james 3.3.0 及 java jdk 链接: https://pan.baidu.com/s/1bsg-6uo8rDvPlUEJm65-pg 提取码: ktu4 

 

支付宝打赏 微信打赏

如果文章对你有帮助,欢迎点击上方按钮打赏作者

 工具推荐 更多»