Simple boilerplate to send email in JAVA.
This simple example uses some popular libs to send email like javax.email. Here, we are getting our attachments from the resource folder, but you can easily edit the code to get attachment from external URLs, for example.
You need to pay attention in some environment variables to do the project run, global constants stay in the config folder. In addiction that, this example is using GMAIL as SMTP server, get the correct hostname and port to differents providers.