- 准备域名
比如域名为 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