Hie.
I have an enterprise application on netbeans 6.0. I want it to send an email whenever a user registers. I have some Javamail code that i have put in an EJB session bean so what i'm not sure is how do in fire an event that calls the sendMail method?
The code in the session bean looks like this:
@Resource(name = "mail/hdsSession")
private Session mailhdsSession;
public void sendMail(String email, String subject, String body) throws NamingException, MessagingException {
MimeMessage message = new meMessage(mailhdsSession);
message.setSubject(subject);
message.setSentDate(new Date());
message.setFrom();
message.setRecipients(javax.mail.Message.RecipientType.TO, javax.mail.internet.InternetAddress.parse(email, false));
message.setText(body);
javax.mail.Transport.send(message);
}
I have an enterprise application on netbeans 6.0. I want it to send an email whenever a user registers. I have some Javamail code that i have put in an EJB session bean so what i'm not sure is how do in fire an event that calls the sendMail method?
The code in the session bean looks like this:
@Resource(name = "mail/hdsSession")
private Session mailhdsSession;
public void sendMail(String email, String subject, String body) throws NamingException, MessagingException {
MimeMessage message = new meMessage(mailhdsSession);
message.setSubject(subject);
message.setSentDate(new Date());
message.setFrom();
message.setRecipients(javax.mail.Message.RecipientType.TO, javax.mail.internet.InternetAddress.parse(email, false));
message.setText(body);
javax.mail.Transport.send(message);
}