Hi!
In one of my lasts projects I wrote an MDB, which reads text messages from a queue and
sends mails to some my mail account. Maybe this helps you a little.
First of all, you have to set up the JBoss mail service in
server//deploy/mail-service.xml. You need to specify the connection properties to the mail
server which is used.
Secondly you write the code to send a mail, for example:
// who should receive the mail
| Address[] to = InternetAddress.parse("duke@java.sun.com,homer(a)simpson.net",
false);
|
| // create a simple text message
| javax.mail.Message message = new MimeMessage(session);
| message.setFrom();
| message.setRecipients(javax.mail.Message.RecipientType.TO, to);
| message.setSubject("Mail subject goes here");
| message.setSentDate(new Date());
| message.setText("java mail rocks!");
|
| // ... and send it
| Transport.send(message);
That's it it :-) If you do not specify the "from" property, the default
value defined in mail-service.xml is used.
Hope that helped! Keep asking, if you have any problems.
cheers,
Andre
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203659#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...