Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Jakarta - EE 10 - Move to the Angus Jakarta Mail implementation #26989

Open
gsmet opened this issue Jul 28, 2022 · 32 comments
Open

Jakarta - EE 10 - Move to the Angus Jakarta Mail implementation #26989

gsmet opened this issue Jul 28, 2022 · 32 comments

Comments

@gsmet
Copy link
Member

gsmet commented Jul 28, 2022

For now, we are using the old implementation targeting EE 9.

EE 10 and Jakarta Mail 2.1 introduced a new implementation called Angus.

Note that there are 2 different artifacts:

We need to choose what's more practical for us but in general I would recommend to use the implementation that does NOT contain the API because otherwise we would have to add exclusions for all artifacts depending on the API.

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 28, 2022

/cc @cescoffier

@gsmet
Copy link
Member Author

gsmet commented Aug 9, 2022

We only it for tests so we will update it when subethasmtp moves to it.

@ppalaga
Copy link
Contributor

ppalaga commented Feb 13, 2023

@gsmet what is the plan here actually? Are you planning to have an Angus Mail extension by any chance? I am looking for a place to consolidate the Angus mail code we have in Camel Quarkus and CXF.

@gastaldi
Copy link
Contributor

After our latest meeting, the idea is to have a quarkus-angus extension in Quarkiverse

@ppalaga
Copy link
Contributor

ppalaga commented Feb 16, 2023

@gastaldi would you please create a qverse repo for angus mail?

@gsmet
Copy link
Member Author

gsmet commented Feb 16, 2023

I'm not sure if having quarkus-angus makes sense. They live in different projects even if they share the same prefix. So probably better to create a quarkus-angus-mail extension.

@ppalaga
Copy link
Contributor

ppalaga commented Feb 16, 2023

@gastaldi I see that the repo exists, but it is empty. Your magic provisioning templates are still to be run?

@gastaldi
Copy link
Contributor

You can use quarkus create extension angus-mail to create the skeleton

@gsmet gsmet reopened this Feb 16, 2023
@github-project-automation github-project-automation bot moved this from Done to In Progress in Quarkus Roadmap/Planning Feb 16, 2023
@gsmet
Copy link
Member Author

gsmet commented Feb 16, 2023

Please don't close my issue, it has nothing to do with the availability of the extension :).

@gsmet
Copy link
Member Author

gsmet commented Feb 16, 2023

You can use quarkus create extension angus-mail to create the skeleton

I think you need to specify the groupId to create a Quarkiverse one?

@gastaldi
Copy link
Contributor

@gsmet no need to. The default is already io.quarkiverse.<PROJECT.NAME>

@gastaldi
Copy link
Contributor

Hm, it generates the groupId as <groupId>io.quarkiverse.angus-mail</groupId>, but I guess it should be io.quarkiverse.angus.mail? WDYT

@gsmet
Copy link
Member Author

gsmet commented Feb 16, 2023

It should either be angusmail or angus.mail if we want to stay consistent with the rest of the extensions.

The dot would make sense if we expect several angus extensions and that might be the case but in general we decided to go with io.quarkiverse.githubapp:quarkus-github-app for instance. Not all the extensions are consistent but most follow this pattern.

@maxandersen
Copy link
Member

issue for angus mail extension is here: #31285

@rsvoboda
Copy link
Member

https://github.com/quarkiverse/quarkus-angus-mail repo is empty.

What are the plans with Angus / Jakarta Mail 2.1?

@gastaldi
Copy link
Contributor

gastaldi commented Aug 30, 2023

@andlinger
Copy link
Contributor

What are the plans with angus?

@mabartos
Copy link
Contributor

mabartos commented Aug 6, 2024

@ppalaga Any progress?

@steinsag
Copy link

I included org.eclipse.angus:angus-mail in my project dependencies to have an implementation of jakarta mail API available as I need to manually craft a MimeMessage. I don't need argus to send the email as I do that via io.quarkiverse.amazonservices:quarkus-amazon-ses sendRawMail function.

This all works fine except in native mode as Angus Mail classes are not registered to be included in native image. I guess an official Quarkus extension would resolve that problem.

Are there any work-arounds to get an implementation of jakarta mail included in native image?

@gastaldi
Copy link
Contributor

We have https://github.com/quarkiverse/quarkus-angus-mail but nothing was pushed to that repository yet.

@gastaldi
Copy link
Contributor

Also it's funny because angus-mail-2.0.3.jar has a META-INF/native-image/org.eclipse.angus directory with native-image.properties and resource-config.json files which Quarkus should have picked. Can you share a reproducer?

@gastaldi
Copy link
Contributor

@maxandersen @ppalaga I've pushed some code to https://github.com/quarkiverse/quarkus-angus-mail. I've tested native locally and it seems to work now.

@steinsag, Can you please try cloning and building the extension locally and using it in your project?

@steinsag
Copy link

steinsag commented Jan 11, 2025

@gastaldi This looks very promising. I used the following classes to construct a raw MimeMessage with HTML and TXT body plus an attachement. I didn't send the email as I will hand over the raw message to AWS SES.

But I think it works, because creating the initial jakarta.mail.Session object already triggers service loader mechanism and the actual implementation of jakarta mail is discovered via reflection and instantiated.

  • jakarta.activation.DataHandler
  • jakarta.mail.Session
  • jakarta.mail.internet.InternetAddress
  • jakarta.mail.internet.MimeBodyPart
  • jakarta.mail.internet.MimeMessage
  • jakarta.mail.internet.MimeMultipart
  • jakarta.mail.util.ByteArrayDataSource

Do we need to register additional ServiceProviderBuildItems on

  • jakarta.activation.spi.MailcapRegistryProvider
  • jakarta.activation.spi.MimeTypeRegistryProvider

as there is a transitive dependency towards jakarta.activation-api?

@gastaldi
Copy link
Contributor

@gastaldi This looks very promising. I used the following classes to construct a raw MimeMessage with HTML and TXT body plus an attachement. I didn't send the email as I will hand over the raw message to AWS SES.

But I think it works, because creating the initial jakarta.mail.Session object already triggers service loader mechanism and the actual implementation of jakarta mail is discovered via reflection and instantiated.

  • jakarta.activation.DataHandler
  • jakarta.mail.Session
  • jakarta.mail.internet.InternetAddress
  • jakarta.mail.internet.MimeBodyPart
  • jakarta.mail.internet.MimeMessage
  • jakarta.mail.internet.MimeMultipart
  • jakarta.mail.util.ByteArrayDataSource

Do we need to register additional ServiceProviderBuildItems on

  • jakarta.activation.spi.MailcapRegistryProvider
  • jakarta.activation.spi.MimeTypeRegistryProvider

as there is a transitive dependency towards jakarta.activation-api?

Already did in https://github.com/quarkiverse/quarkus-angus-mail/blob/main/deployment/src/main/java/io/quarkiverse/angus/mail/deployment/AngusActivationProcessor.java

Feel free to create issues there and submit PRs if needed

@steinsag
Copy link

So everything seems to be ready. What is needed now to get this officially released?

@gastaldi
Copy link
Contributor

gastaldi commented Jan 12, 2025

I'll add some tests and release 0.0.1 afterwards

@steinsag
Copy link

Any chance to get it released today? Otherwise, I would need to create a private fork.

@gsmet
Copy link
Member Author

gsmet commented Jan 14, 2025

/cc @gastaldi ^

@gsmet
Copy link
Member Author

gsmet commented Jan 14, 2025

Apparently, @gastaldi can read minds as I see a release is already in progress :).

@gastaldi
Copy link
Contributor

@github-project-automation github-project-automation bot moved this from In Progress to Done in Quarkus Roadmap/Planning Jan 14, 2025
@gastaldi gastaldi reopened this Jan 14, 2025
@github-project-automation github-project-automation bot moved this from Done to In Progress in Quarkus Roadmap/Planning Jan 14, 2025
@gastaldi
Copy link
Contributor

@gsmet not sure if this issue is okay to be closed, so I'll leave it for you to decide

@steinsag
Copy link

...and live on production :-)

Thank you very much @gastaldi for your support!

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
Status: In Progress
Development

No branches or pull requests

8 participants