Constantino Jacob wrote:
What version of Geronimo are you using? The javamail support was
improved significantly in the 1.1 release.
Try adding
emailProperties.put("mail.debug", "true");
which will dump out the session conversation so I can see what has
actually happened. The debug output will be most useful if you're using
Geronimo 1.1.
Rick
Hi,
I have the following code that he functions with the Tomcat without no
problem:
( summarized version )
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class Email {
/** Creates a new instance of Email */
private Email() {
}
public static void enviaEmail(String smtpHost, String
smtpPassword, String emailFrom, String emailTo, String subject, String
text) {
Properties emailProperties = new Properties();
emailProperties.put("mail.host", smtpHost);
// Any code . . .
Session session = Session.getInstance(emailProperties);
MimeMessage msg = new MimeMessage(session);
try {
msg.setFrom(new InternetAddress(emailFrom));
msg.setRecipient(Message.RecipientType.TO
<http://Message.RecipientType.TO>, new InternetAddress(emailTo));
msg.setSentDate(new Date());
msg.setSubject (assunto);
msg.setText(text);
Transport.send(msg);
} catch (AuthenticationFailedException e) {
e.printStackTrace();
} catch (AddressException e) {
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
No error is generated when executed in the Geronimo, but the message
never sent arrives in the addressee. Using only the Tomcat, the code
functions perfectly (the email always arrives at the destination). I
am using in my application the javamail ( javamail-1.4) and all jars
had been copied for the directory lib of my application.
Anticipatedly, I am thankful for any assistance.
Jacob