Put the code that sends the email in an @Asynchronous method.
Example:
@Stateless
public class EmailSender {
@Asynchronous
public void sendMail(...) {
// send mail here
}
}
From the place where you do your business logic:
@Inject
private EmailSender emailSender;
public Foo myBusiness() {
// Compute stuff
emailSender.sendMail(stuff); // returns immediately
// do other stuff if needed
}
See the Oracle tutorial for some extra info.