下载地址:https://dlcdn.apache.org/james/server/
版本:3.2.0(java使用1.8),试了3.6.2之后的都要求使用java11
下载:james-server-app-3.6.2-app.zip
解压之后修改相关配置就行,无需其他复杂操作,简单方便
sudo vi /opt/apache-james/conf/domainlist.xml
(2) 配置域名
<domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
<autodetect>falseautodetect>
<autodetectIP>falseautodetectIP>
<defaultDomain>test.comdefaultDomain>
domainlist>
需要将配置中的defaultDomain改为自己的域名。
如果该James实例需要同时支持多个不同的域名,则需要配置domainnames节:
<domainlist class="org.apache.james.domainlist.xml.XMLDomainList">
<domainnames>
<domainname>mail1.comdomainname>
<domainname>mail2.comdomainname>
domainnames>
<autodetect>trueautodetect>
<autodetectIP>trueautodetectIP>
<defaultDomain>test.comdefaultDomain>
domainlist>
mysql-> create database if not exists james default character set UTF8MB4;
(2) 编辑配置
sudo vi /opt/apache-james/conf/james-database.properties
(3) 配置MySQL
Apache James默认使用DERBY数据库来存储邮件数据,我们需要将其默认数据库链接注释,并添加新的MySQL配置;
a. 注释以下配置
#database.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
#database.url=jdbc:derby:../var/store/derby;create=true
#database.username=app
#database.password=app
b. 修改以下配置
# Supported adapters are:
# DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
vendorAdapter.database=MYSQL
c. 添加MySQL配置
database.driverClassName=com.mysql.cj.jdbc.Driver
database.url=jdbc:mysql://127.0.0.1:3306/james?useUnicode=true&allowMultiQueries=true&characterEncoding=UTF-8&useSSL=false
database.username=[UserName]
database.password=[Password]
注意修改MySQL的服务器IP地址、账号和密码。
(4) 下载MySQL的Java驱动
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.30/mysql-connector-java-8.0.25.jar
sudo mv mysql-connector-java-8.0.25.jar /opt/apache-james/lib
3.启动邮件服务
./bin/run.sh
4.创建用户
./bin/james-cli.sh -h localhost -p 9999 adduser [email protected] admin
./bin/james-cli.sh -h localhost -p 9999 adduser [email protected] test
5.邮件客户端
可Thunderbird或者foxmail进行验证
参考:https://www.cnblogs.com/eagle6688/p/17093139.html