I don't know if this is the correct answer, but once I did something like this:
in my jboss.xml I added this:
I had a class that was in charge only of sending emails. So whenever i needed to send an email (or many emails) I'd invoke this class, and my code did something like this:
there was another configuration file in which you added your SMTP sever, so you wouldn't need to hardcode it, but I cant remember which was
I don't know if this is the correct way, it's only a suggestion