Hi,
within my stateful session bean i am using the following method, for sending an
e-mail:
| private void sendMail(String subject, String receiver, String sender,
| String content, String mailbox, String
password,
| String mailServer) {
| Password authenticator = new Password(mailbox, password);
| Properties sendProps = new Properties();
| sendProps.put("mail.smtp.host", mailServer);
| session = Session.getInstance(sendProps, authenticator);
| try{
| Message message = new MimeMessage(session);
| message.setFrom(new InternetAddress(sender));
| InternetAddress[] to = { new InternetAddress(receiver)};
| message.setRecipients(Message.RecipientType.TO, to);
| message.setSubject(subject);
| message.setSentDate(new Date());
| message.setText(content);
| Transport.send(message);
| }catch(MessagingException mex) { mex.printStackTrace(); }
| }
|
but if i try sending i receive the following error:
|
| 12:29:28,592 INFO [STDOUT] javax.mail.MessagingException: Could not
connect to SMTP host: localhost, port: 25, response: -1
| 12:29:28,592 INFO [STDOUT] at
com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1201)
| 12:29:28,592 INFO [STDOUT] at
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:311)
|
As you can see, the smtp host is set to localhost - but that is not what i set
for the mailServer parameter, when i am calling up the method.
Of course, i can set a resource-reference in the ejb-jar.xml respectively
jboss.xml but i want the parameters to be different for each method call.
Does anybody have a solution to this problem?
Thanks for any advices!
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3891133#3891133
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3891133
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user