我已成功安装并启动 Apache James。
当我尝试连接 WebAdmin 时,它显示:
{"statusCode":404,"type":"notFound","message":"GET / can not be found","details":null}
所以我无法访问 WebAdmin。我按照官方文档...安装jdk 11,下载JPA Guice二进制文件,配置然后运行。
从文档中我了解到 WebAdmin 的唯一文件conf是conf/webadmin.properties,但在此文件中只有端口和主机的参数。
$ java -version
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment Temurin-11.0.18+10 (build 11.0.18+10)
OpenJDK 64-Bit Server VM Temurin-11.0.18+10 (build 11.0.18+10, mixed mode)
https://james.apache.org/download.cgi
Apache James 3.8.0 是最新的稳定版本
JPA James 服务器的二进制(ZIP 格式):james-server-jpa-guice.zip
https://www.apache.org/dyn/closer.lua/james/server/3.8.0/james-server-jpa-guice.zip
unzip james-server-jpa-guice.zip
cd james-server-jpa-guice
keytool -genkey -alias james -keyalg RSA -keystore conf/keystore
输入密码:
james72laBalle
(使用此密码可以找到imapserver.xml)
sudo PATH=$PATH sh -c "java -javaagent:james-server-jpa-app.lib/openjpa-3.2.0.jar \
-Dworking.directory=. \
-Djdk.tls.ephemeralDHKeySize=2048 \
-Dlogback.configurationFile=conf/logback.xml \
-jar james-server-jpa-app.jar"
参考文档:https://james.apache.org/server/manage-webadmin.html
$ curl -XGET http://localhost:8000/healthcheck
{"status":"healthy","checks":[{"componentName":"Guice application lifecycle","escapedComponentName":"Guice%20application%20lifecycle","status":"healthy","cause":null},{"componentName":"MailReceptionCheck","escapedComponentName":"MailReceptionCheck","status":"healthy","cause":null},{"componentName":"EventDeadLettersHealthCheck","escapedComponentName":"EventDeadLettersHealthCheck","status":"healthy","cause":null},{"componentName":"EmptyErrorMailRepository","escapedComponentName":"EmptyErrorMailRepository","status":"healthy","cause":null},{"componentName":"Embedded ActiveMQ","escapedComponentName":"Embedded%20ActiveMQ","status":"healthy","cause":null}]}
您可以将管道添加到jq以获取格式json
$ curl -XGET http://localhost:8000/healthcheck | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 658 0 658 0 0 38705 0 --:--:-- --:--:-- --:--:-- 38705
{
"status": "healthy",
"checks": [
{
"componentName": "Guice application lifecycle",
"escapedComponentName": "Guice%20application%20lifecycle",
"status": "healthy",
"cause": null
},
{
"componentName": "MailReceptionCheck",
"escapedComponentName": "MailReceptionCheck",
"status": "healthy",
"cause": null
},
{
"componentName": "EventDeadLettersHealthCheck",
"escapedComponentName": "EventDeadLettersHealthCheck",
"status": "healthy",
"cause": null
},
{
"componentName": "EmptyErrorMailRepository",
"escapedComponentName": "EmptyErrorMailRepository",
"status": "healthy",
"cause": null
},
{
"componentName": "Embedded ActiveMQ",
"escapedComponentName": "Embedded%20ActiveMQ",
"status": "healthy",
"cause": null
}
]
}
其他测试命令:
curl -XGET http://localhost:8000/healthcheck | jq
curl -XGET http://localhost:8000/healthcheck/checks | jq
curl -XGET http://localhost:8000/domains | jq
curl -XGET http://localhost:8000/users | jq
创建邮件域
$ curl -XPUT http://localhost:8000/domains/mail123.demo.local
列出邮件域
$ curl -XGET http://localhost:8000/domains | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 34 0 34 0 0 2833 0 --:--:-- --:--:-- --:--:-- 2833
[
"localhost",
"mail123.demo.local"
]
创建用户:
[email protected]
curl -XPUT http://localhost:8000/users/[email protected] \
-d '{"password":"password1234567"}' \
-H "Content-Type: application/json"