question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Email Delivery Failure

See original GitHub issue

I have tried all of the various SMTP options for mail delivery, however, the server fails to properly send mail regardless of the method I use. It recognizes the method it is attempting to send with, but always fails with an error stating that there is no appropriate protocol.

org.simplejavamail.mailer.internal.MailerException: Third party error
	at org.simplejavamail.mailer.internal.SendMailClosure.executeClosure(SendMailClosure.java:91)
	at org.simplejavamail.mailer.internal.AbstractProxyServerSyncingClosure.run(AbstractProxyServerSyncingClosure.java:56)
	at org.simplejavamail.internal.util.concurrent.AsyncOperationHelper$1.run(AsyncOperationHelper.java:75)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: javax.mail.MessagingException: Could not convert socket to TLS
	at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1907)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:666)
	at javax.mail.Service.connect(Service.java:317)
	at javax.mail.Service.connect(Service.java:176)
	at javax.mail.Service.connect(Service.java:125)
	at org.simplejavamail.mailer.internal.util.TransportRunner.runOnSessionTransport(TransportRunner.java:75)
	at org.simplejavamail.mailer.internal.util.TransportRunner.sendMessage(TransportRunner.java:48)
	at org.simplejavamail.mailer.internal.SendMailClosure.executeClosure(SendMailClosure.java:82)
	... 7 common frames omitted
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
	at java.base/sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:170)
	at java.base/sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:98)
	at java.base/sun.security.ssl.TransportContext.kickstart(TransportContext.java:221)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:443)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:421)
	at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:549)
	at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:486)
	at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1902)
	... 14 common frames omitted
05:17:06.349 [pool-24-thread-1] WARN  c.s.c.c.p.provider.EmailServiceImpl - Email cannot be delivered

It, however, properly reflects the options as I change them in the config.

DEBUG o.s.m.internal.util.SessionLogger - starting async mail with session (host: smtp.<REDACTED>.com, port: 587, username: <REDACTED>, authenticate: true, transport: SMTP)
DEBUG o.s.m.internal.util.SessionLogger - starting async mail with session (host: smtp.<REDACTED>.com, port: 587, username: <REDACTED>, authenticate: true, transport: SMTPS)
DEBUG o.s.m.internal.util.SessionLogger - starting async mail with session (host: smtp.<REDACTED>.com, port: 587, username: <REDACTED>, authenticate: true, transport: SMTP_TLS)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
matusfarocommented, May 5, 2022

Try the different options for smtpStrategy config, options are SMTP, SMTP_TLS, SMTPS. This may be misconfigured.

com.smotana.clearflask.core.push.provider.EmailServiceImpl$Config.smtpStrategy=<SMTP, SMTP_TLS, SMTPS>

I am adding a config property for overriding the domain name, in a few hours check for version 1.5.9. Also you will be able to modify the local part as well (ie noreply@...).

com.smotana.clearflask.core.push.provider.EmailServiceImpl$Config.fromEmailLocalPart=noreply
com.smotana.clearflask.core.push.provider.EmailServiceImpl$Config.fromEmailDomainOverride=zandercraft.ca

There already is a config for overriding email sending name:

com.smotana.clearflask.core.push.provider.EmailServiceImpl$Config.emailDisplayName=ZanderCraft

All available configs for 1.5.8 are listed here: https://github.com/clearflask/clearflask/blob/1.5.8/clearflask-server/src/main/java/com/smotana/clearflask/core/push/provider/EmailServiceImpl.java

1reaction
matusfarocommented, Apr 30, 2022

Hmm, the docker container has this under $JAVA_HOME/conf/security/java.security:

jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
    DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
    include jdk.disabled.namedCurves

So it seems to be fine unless I’m misreading it.

Can you modify your docker-compose.yml file to include the following JAVA_OPTS:

  clearflask-server:
    ...
    environment:
      - ...
      - JAVA_OPTS="-Djavax.net.debug=ssl"

Then restart and look at the extra logs. You should see logs similar to the following:

Ignoring unavailable cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
...

Please post the output including anything interesting around it.

The alternate option you have is to modify the docker container to comment out the jdk.tls.disabledAlgorithms in $JAVA_HOME/conf/security/java.security line and try it out. If it works, just keep using that modified container.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sent email in Outlook.com comes back "delivery failed"
This message means that the recipient has too many messages in their inbox. Many email systems prevent users from receiving any new mail...
Read more >
Email delivery failure: the 3 most common causes
1. Bounces. The simplest case is when you get a bounce: for instance, when the recipient's address is full (a soft bounce: just...
Read more >
Mail Delivery Failed: Returning Message to Sender
Resolving Mail delivery failed: returning message to sender bounce-backs · Check the spelling of the email address for typos · Check that the...
Read more >
How to Solve Email Delivery Failures and Bouncebacks
If a message fails, that connection or transfer has failed for some reason. Your mail server will know it failed, and should notify...
Read more >
Why do I keep getting "Mail delivery failed: returning ...
In both cases the most common reason for getting “Mail delivery failed: returning message to sender” bounce back emails from your website, is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found