I´ve migrated to Jakarta EE and I was using java mail before as well. It seems like the code has changed and I got now a compiler issue if I´m trying to sorted:
This