Skip to content

javamail.providers file missing from provider jars after 1.6.5 #493

@worpet

Description

@worpet

Describe the bug
After upgrading to version 1.6.5, javamail.providers is missing from the Jakarta Mail provider jars. For example, for smtp.jar:

1.6.4 https://repo1.maven.org/maven2/com/sun/mail/smtp/1.6.4/smtp-1.6.4.jar

image

1.6.5 https://repo1.maven.org/maven2/com/sun/mail/smtp/1.6.5/smtp-1.6.5.jar

image

Unless you use the full jakarta.mail.jar, there are no provider properties files included from which to load the providers. No behavior changes for this were noted in CHANGES.txt.

In some cases, providers will still load due to the "fake it" logic in Session.java, but it is not reliable:
https://github.com/eclipse-ee4j/mail/blob/c3096cbeaf566f36998e96ff384378059f291ce8/mail/src/main/java/jakarta/mail/Session.java#L982-L987

If at least one provider from elsewhere loads, the above condition will not be met and Jarkarta Mail providers will not load. For example, in one project we have a dependency on aws-java-sdk-ses.jar from AWS, which happens to include its own javamail.providers. This makes it so there are not 0 providers, the "fake it" condition is not met, and so the Jarkarta Mail SMTP provider is never loaded.

Expected behavior
Using mailapi.jar with smtp.jar version 1.6.5 or higher should result in the SMTP provider working, regardless of any extra 3rd party providers loaded. The smtp.jar should include javamail.providers, as it used to, so it can register itself to be loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions