• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to send an automated mail upon registration?

 
manoj rajkumar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
In my portal project, we have a requirement:
Requirement: When a user is registered (new user created), a mail needs to be sent to the administrator.

I need a headstart on this, it would be simpler for me if you could suggest links/resources (containing examples) that explain how this can be done .

Thanks
 
sander hautvast
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not that hard
get a mailsession from the container (see admin) (or, not as good: create your own)
create a javax.mail.Message with the session. Populate it and send.
see javax.mail package for details
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Quintessential Program to Send E-Mail [J2EE]
 
manoj rajkumar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the 2 responses, they provided an insight into the mail api.
but am getting more greedy here;
Is there an example that caters exactly to the requirement provided by my boss?
(Why make a design, when there is already an existing design pattern ? )
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember to provide for the situation in which the mail server is slow or not available. In other words, don't make the response wait on the mail sending process.

Bill
 
Harshad Khasnis
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally Posted by Chetan Parekh

What are the changes required in this particular program if I want to use IMAP instead of SMTP.

Thanks & Regards.
Harshad
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMAP (like POP3) is a protocol for accessing mail stores, i.e. for receiving mail, not for sending mail. You'll have to use SMTP.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!