-
1. Re: Wildfly 8.1.0 Final Mail-Session always uses localhost
wdfink Jun 8, 2014 7:51 AM (in response to tomas.kainbacher)Looks like the outbound-connection is not used.
Could you see whether DEBUG or TRACE will show what happen?
Also how the code look like?
-
2. Re: Wildfly 8.1.0 Final Mail-Session always uses localhost
tomas.kainbacher Jun 8, 2014 5:03 PM (in response to wdfink)I'm creating the mail session in Java for now to get on with work, but i will recreate the error tomorrow(which is simple, config from above and code as below) and post the full output.
The code looked something like this:...
@Stateless
public class SendMail {
@Resource(lookup = "java:jboss/mail/gmail")
private Session mailSession;
public String send() {
MimeMessage m = new MimeMessage(mailSession);
try {
m.setRecipients(Message.RecipientType.TO, "test@mail.com");
m.setContent("Test from Wildfly","text/plain");
Transport.send(m);//throws exception
} catch (MessagingException e) {
e.printStackTrace();
}
... -
3. Re: Wildfly 8.1.0 Final Mail-Session always uses localhost
jaikiran Jun 8, 2014 11:16 PM (in response to tomas.kainbacher)Transport.send(m);//throws exception
You are using the wrong method (the static one). The session you have injected isn't being used at all from what I see in that code. See the javadoc of that method for details. There's a getTransport() method on the Session class which is what you would want to use.
Edit: I don't know why the editor decided to use brown colour for the text of my reply!