• Post Reply Bookmark Topic Watch Topic
  • New Topic

sending an email from a EJB  RSS feed

 
Fiona Healy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone any good links/tutorials on how to send emails from an enterprise java bean?
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sending an email from an EJB is no different from anywhere else. I suggest you start by taking a look at the JavaMail API, by searching the Java website or Google.
 
Fiona Healy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so i just write a class that is queried by the EJB? I have seen examples wherby they have made email sending beans. Is this necessary?
 
Ken Krebs
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your EJB needs to send an email, have it delegate the task to a POJO.
Why ?? POJO's are a lot easier to test and not so heavyweight.
In fact, it's best to do as little as possible in an EJB, IMO.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!