Reputation: 9289
Given the following snippet of code:
public static void main(String[] args) throws Exception {
final Email email = new SimpleEmail();
email.setHostName("smtp.gmail.com");
email.addTo("[email protected]", "Manuel");
email.setFrom("[email protected]");
email.setSubject("daje mpo");
email.setContent("<html><body>22dlkjalskdj <strong>strong</strong><em>em</em><br>aslkdjsal</body></html>", "text/html");
email.setAuthentication("[email protected]", "mypassword");
email.setDebug(true);
email.setSSL(true);
email.setTLS(true);
String s = email.send();
System.out.println();
System.out.println(s);
}
When I execute this piece of code in Eclipse, I receive an email like:
That is what I want!
But then, I tried to use this main
inside my application deployed in Jboss-4.0.5, I receive an email like this:
So not only the message isn't an html message, but also the subject of the email was lost, and it seems that instead of send the email with the to receiver it uses a bcc.
I don't have any idea of what can be the cause of this behavior, can someone help me, or just give me some hint.
UPDATE
I notice that when I execute that code "inside" JBoss it doesn't send any headers of the mail message, while executing the same code "inside" Eclipse send the correct message...
I tried to remove all the mail jars in JBoss but it still act this way...
Upvotes: 0
Views: 158
Reputation: 666
I think you should use
HtmlEmail email = new HtmlEmail();
...
no matter what you're actual problem is.
Upvotes: 0