SMTP nefunguje na VPS, jen na lokále

Vyřešeno190 zhlédnutíWebhosting
0

Zdravím, mám od vás webmail a snažím se použít váš SMTP server ve springboot aplikaci. Problém je, že na localhostu vše funguje a email se odešle, ale když deploynu na VPS, dostanu tento stacktrace, z kterého lze vyčíst, že připojení na SMTP i autentizace proběhne úspěšně, ale přece jen z nějakého duvodu nakonec: Failed to send mail, dokáže někdo pomoci?

PS: FROM email jsem přepsal záměrně pro účel dotazu, normálně tam mám email s mojí domenou

:

DEBUG: setDebug: Jakarta Mail version 2.0.1
DEBUG: getProvider() returning jakarta.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: need username and password for authentication
DEBUG SMTP: protocolConnect returning false, host=wes1-smtp.wedos.net, user=martin.lepic@email.cz, password=<null>
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "wes1-smtp.wedos.net", port 587, isSSL false
220 wes1-so2.wedos.net ESMTP Postfix - S.T.A.N.D.A. postak OUT
DEBUG SMTP: connected to host "wes1-smtp.wedos.net", port: 587
EHLO 5575e5731be3
250-wes1-so2.wedos.net
250-PIPELINING
250-SIZE 104857600
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "SIZE", arg "104857600"
DEBUG SMTP: Found extension "VRFY", arg ""
DEBUG SMTP: Found extension "ETRN", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
STARTTLS
220 2.0.0 Ready to start TLS
EHLO 5575e5731be3
250-wes1-so2.wedos.net
250-PIPELINING
250-SIZE 104857600
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "SIZE", arg "104857600"
DEBUG SMTP: Found extension "VRFY", arg ""
DEBUG SMTP: Found extension "ETRN", arg ""
DEBUG SMTP: Found extension "AUTH", arg "PLAIN LOGIN"
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: protocolConnect login, host=wes1-smtp.wedos.net, user=martin.lepic@email.cz, password=<non-null>
DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM XOAUTH2
DEBUG SMTP: Using mechanism LOGIN
DEBUG SMTP: AUTH LOGIN command trace suppressed
DEBUG SMTP: AUTH LOGIN succeeded
DEBUG SMTP: use8bit false
MAIL FROM:<martin.lepic@email.cz>
250 2.1.0 Ok
RCPT TO:<martin.lepic@email.cz>
250 2.1.5 Ok
DEBUG SMTP: Verified Addresses
DEBUG SMTP:   martin.lepic@email.cz
DATA
354 End data with <CR><LF>.<CR><LF>
Date: Tue, 30 May 2023 18:08:21 +0000 (UTC)
From: martin.lepic@email.cz
To: martin.lepic@email.cz
Message-ID: <1085117917.0.1685470101618@5575e5731be3>
Subject: Email Subject
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
 QUIT
DEBUG SMTP: exception reading response, THROW:
java.net.SocketTimeoutException: Read timed out
 at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
 at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
 at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
 at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
 at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
 at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
 at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
 at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)
 at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1455)
 at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1059)
 at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:102)
 at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
 at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263)
 at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:100)
 at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2456)
 at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:1396)
 at org.simplejavamail.mailer.internal.util.TransportRunner.runOnSessionTransport(TransportRunner.java:74)
 at org.simplejavamail.mailer.internal.util.TransportRunner.sendMessage(TransportRunner.java:51)
 at org.simplejavamail.mailer.internal.SendMailClosure.executeClosure(SendMailClosure.java:69)
 at org.simplejavamail.mailer.internal.AbstractProxyServerSyncingClosure.run(AbstractProxyServerSyncingClosure.java:56)
 at org.simplejavamail.mailer.internal.MailerImpl.sendMail(MailerImpl.java:363)
 at org.simplejavamail.mailer.internal.MailerImpl.sendMail(MailerImpl.java:348)
 at cz.digikyblik.main.services.EmailService.simpleMail(EmailService.java:63)
 at cz.digikyblik.main.services.BucketService.lambda$createBucket$0(BucketService.java:79)
 at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
 at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
 at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
 at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
 at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
 at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
 at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
org.simplejavamail.mailer.internal.MailerException: Failed to send email [ID: '<1085117917.0.1685470101618@5575e5731be3>'], reason: Unknown error
 at org.simplejavamail.mailer.internal.SendMailClosure.handleException(SendMailClosure.java:85)
 at org.simplejavamail.mailer.internal.SendMailClosure.executeClosure(SendMailClosure.java:76)
 at org.simplejavamail.mailer.internal.AbstractProxyServerSyncingClosure.run(AbstractProxyServerSyncingClosure.java:56)
 at org.simplejavamail.mailer.internal.MailerImpl.sendMail(MailerImpl.java:363)
 at org.simplejavamail.mailer.internal.MailerImpl.sendMail(MailerImpl.java:348)
 at cz.digikyblik.main.services.EmailService.simpleMail(EmailService.java:63)
 at cz.digikyblik.main.services.BucketService.lambda$createBucket$0(BucketService.java:79)
 at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
 at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
 at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
 at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
 at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
 at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
 at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.lang.RuntimeException: Provider for jakarta.activation.spi.MailcapRegistryProvider cannot be found
 at jakarta.activation.FactoryFinder.find(FactoryFinder.java:90)
 at jakarta.activation.MailcapCommandMap.getImplementation(MailcapCommandMap.java:696)
 at jakarta.activation.MailcapCommandMap.loadFile(MailcapCommandMap.java:284)
 at jakarta.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:154)
 at jakarta.activation.CommandMap.getDefaultCommandMap(CommandMap.java:60)
 at jakarta.activation.DataHandler.getCommandMap(DataHandler.java:128)
 at jakarta.activation.DataHandler.getDataContentHandler(DataHandler.java:590)
 at jakarta.activation.DataHandler.writeTo(DataHandler.java:290)
 at jakarta.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1670)
 at jakarta.mail.internet.MimeMessage.writeTo(MimeMessage.java:1888)
 at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1300)
 at org.simplejavamail.mailer.internal.util.TransportRunner.lambda$sendMessage$0(TransportRunner.java:53)
 at org.simplejavamail.mailer.internal.util.TransportRunner.runOnSessionTransport(TransportRunner.java:73)
 at org.simplejavamail.mailer.internal.util.TransportRunner.sendMessage(TransportRunner.java:51)
 at org.simplejavamail.mailer.internal.SendMailClosure.executeClosure(SendMailClosure.java:69)
 ... 12 more
 Suppressed: jakarta.mail.MessagingException: Exception reading response;
  nested exception is:
 java.net.SocketTimeoutException: Read timed out
  at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2476)
  at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:1396)
  at org.simplejavamail.mailer.internal.util.TransportRunner.runOnSessionTransport(TransportRunner.java:74)
  ... 14 more
 Caused by: java.net.SocketTimeoutException: Read timed out
  at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
  at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
  at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
  at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
  at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
  at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
  at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
  at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)
  at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1455)
  at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1059)
  at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:102)
  at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
  at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:263)
  at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:100)
  at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2456)
  ... 16 more

Role: Zákazník
Otázka je uzamčena pro nové odpovědi.
JP328023 Vybral nejlepší odpověď 31. 5. 2023
0

Tak už jsem to opravil, problém byl, že docker kontejner neměl přístup k nějakým dependencím, takže jsem se musel dát do pom

Role: Zákazník
JP328023 Vybral nejlepší odpověď 31. 5. 2023