无法连接到运行在 Docker 容器中的 Apache James 邮件服务器,使用 Thunderbird。

huangapple go评论56阅读模式
英文:

Cant connect to Apache James mailserver in Docker container with Tunderbird

问题

Sure, here are the translations for the relevant parts of your text:

I generated the keystore with the following command in the powershell:
我使用以下命令在PowerShell中生成了密钥库:

Then I started the Docker container with the following command:
然后我使用以下命令启动了Docker容器:

In the logs after the start, everything seems just fine:
在启动后的日志中,一切都看起来很好:

These are the logs for the first configuration:
这是第一个配置的日志:

And for the second configuration:
以及第二个配置的日志:

I understand, that the logs for the second configuration indicate, that there is a problem with the SSL-certificate, but I dont know the reason why. Furthermore I dont understand, why the first configuration is not working.
我理解,第二个配置的日志表明SSL证书存在问题,但我不知道原因。此外,我不明白为什么第一个配置不起作用。

Because I dont know how to continue, I am seeking for your help. Thanks in advance!
因为我不知道如何继续,所以寻求您的帮助。提前感谢您!

I expected, that the Thunderbird configurations would work an that I could test sending mails locally with Thunderbird. After this, I want to connect a Spring Boot backend to the mailserver and test sending mails wie Spring Mail.
我预期Thunderbird的配置将起作用,并且我可以使用Thunderbird在本地测试发送邮件。之后,我想将Spring Boot后端连接到邮件服务器,并使用Spring Mail测试发送邮件。

英文:

I want to set up an Apache James mailserver in a Docker container and connect this to Thunderbird.

I generated the keystore with the following command in the powershell:

keytool -genkeypair -alias myalias -keyalg RSA -keysize 2048 -keystore keystore

Then I started the Docker container with the following command:

docker run --name james_run `
>> -p "25:25" `
>> -p "143:143" `
>> -p "465:465" `
>> -p "993:993" `
>> -v ${PWD}\test\keystore:/root/conf/keystore `
>> apache/james:jpa-latest

Then I added the domain example.com and the user user01@example.com with the password test to the domain.
Screenshot of PowerShell


After this, I wanted to connect Thunderbird to the Docker container with the following configuration:
Screenshot of Thunderbird configuration 1
Email Address: user01@example.com
Password: test

Email Address: user01@example.com
Password: test

INCOMING SERVER
Protocol: IMAP
Hostname: localhost
Port: 143
Connection security: None
Authentification method: Normal password
Username: user01@example.com

OUTGOING SERVER
Hostname: localhost
Port: 25
Connection security: None
Authentification method: Normal password
Username: user01@example.com


I also tried this configuration for IMAPS and SMTPS:
Screenshot of Thunderbird configuration 2

Email Address: user01@example.com
Password: test

INCOMING SERVER
Protocol: IMAP
Hostname: localhost
Port: 993
Connection security: SSL/TLS
Authentification method: Normal password
Username: user01@example.com

OUTGOING SERVER
Hostname: localhost
Port: 465
Connection security: SSL/TLS
Authentification method: Normal password
Username: user01@example.com


In the logs after the start, everything seems just fine:


These are the logs for the first configuration:

> 11:26:59.796 [INFO ] o.a.j.i.n.ImapChannelUpstreamHandler - Connection established from 172.17.0.1
>
> 11:26:59.799 [INFO ] o.a.j.p.n.BasicChannelUpstreamHandler - Connection established from 172.17.0.1
>
> 11:26:59.799 [INFO ] o.a.j.i.n.ImapChannelUpstreamHandler - Connection closed for 172.17.0.1
>
> 11:26:59.801 [INFO ] o.a.j.p.n.BasicChannelUpstreamHandler - Connection closed for 172.17.0.1
>
> 11:26:59.801 [INFO ] o.a.j.p.n.BasicChannelUpstreamHandler - Channel closed before we could send in flight messages to the users (ClosedChannelException): null
>


And for the second configuration:

> 1:27:52.961 [INFO ] o.a.j.i.n.ImapChannelUpstreamHandler - Connection established from 172.17.0.1

> 11:27:52.961 [INFO ] o.a.j.p.n.BasicChannelUpstreamHandler - Connection established from 172.17.0.1
>
> 11:27:52.962 [INFO ] o.a.j.p.n.BasicChannelUpstreamHandler - Channel closed before we could send in flight messages to the users (ClosedChannelException): null
>
> 11:27:52.961 [WARN ] o.a.j.i.n.ImapChannelUpstreamHandler - Error while processing imap request
>
> javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate
>
> at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
>
> at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
>
> at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
>
> at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
>
> at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
>
> at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
>
> at java.base/sun.security.ssl.SSLEngineImpl.decode(Unknown Source)
>
> at java.base/sun.security.ssl.SSLEngineImpl.readRecord(Unknown Source)
>
> at java.base/sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source)
>
> at java.base/sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source)
>
> at java.base/javax.net.ssl.SSLEngine.unwrap(Unknown Source)
>
> at org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1219)
>
> at org.jboss.netty.handler.ssl.SslHandler.decode(SslHandler.java:852)
>
> at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
>
> at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
>
> at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
>
> at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
>
> at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
>
> at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
>
> at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
>
> at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
>
> at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
>
> at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
>
> at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
>
> at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
>
> at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
>
> at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
>
> at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>
> at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>
> at java.base/java.lang.Thread.run(Unknown Source)
>
> 11:27:52.961 [ERROR] o.a.j.p.n.BasicChannelUpstreamHandler - Unable to process request
>
> javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate
>
> at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
>
> at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
>
> at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
>
> at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
>
> at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
>
> at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
>
> at java.base/sun.security.ssl.SSLEngineImpl.decode(Unknown Source)
>
> at java.base/sun.security.ssl.SSLEngineImpl.readRecord(Unknown Source)
>
> at java.base/sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source)
>
> at java.base/sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source)
>
> at java.base/javax.net.ssl.SSLEngine.unwrap(Unknown Source)
>
> at org.jboss.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1219)
>
> at org.jboss.netty.handler.ssl.SslHandler.decode(SslHandler.java:852)
>
> at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:425)
>
> at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
>
> at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
>
> at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
>
> at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
>
> at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
>
> at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
>
> at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
>
> at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
>
> at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
>
> at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
>
> at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
>
> at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
>
> at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
>
> at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>
> at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>
> at java.base/java.lang.Thread.run(Unknown Source)
>
> 11:27:52.964 [INFO ] o.a.j.i.n.ImapChannelUpstreamHandler - Connection closed for 172.17.0.1
>
> 11:27:52.964 [INFO ] o.a.j.p.n.BasicChannelUpstreamHandler - Connection closed for 172.17.0.1


I understand, that the logs for the second configuration indicate, that there is a problem with the SSL-certificate, but I dont know the reason why. Furthermore I dont understand, why the first configuration is not working.

Because I dont know how to continue, I am seeking for your help. Thanks in advance!

I expected, that the Thunderbird configurations would work an that I could test sending mails locally with Thunderbird. After this, I want to connect a Spring Boot backend to the mailserver and test sending mails wie Spring Mail.

答案1

得分: 0

我之前使用端口25和端口465进行SMTP。我了解到它们已经过时,现在你们使用端口587进行SMTP。所以通过将SMTP的端口切换到端口587,问题得以解决。

英文:

I was using port 25 and port 465 for STMP.

I learned, that they are outdated and that you are using port 587 for SMTP nowadays.

So by switching the port for STMP to port 587 it worked.

huangapple
  • 本文由 发表于 2023年4月20日 01:09:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76057161.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定