geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arun Venugopal <>
Subject javamail issue
Date Wed, 14 Dec 2005 11:31:50 GMT


I have this piece of code that uses javamail .  This code works fine
when i try it as a standalone java application (ie when i put it in java
file, compile it and run it). But when i put this code in an war (and
call it from a servlet) and then deploy the war in geronimo, it does not
work. I am pretty sure that this code is being called as any
System.out.println that i give in between the code gets displayed in the
console. Also i tried out the same code in JBoss and it seems to work
there also. 

I have seen many discussions in the dev list regarding the JavaMail
implementation. But i think all that is with regards to creating a new
API for geronimo in the lines of the mail API's present in JBoss. And
that since i am using plain java mail it should work irrespective of the
application server.

Can any one give me any pointers on why i am having this issue in
geronimo and if i can solve it ...


        //substitute your mail address here
        String from = "a@b.c";
        String to = "a@b.c";
        //substitute the host name or ip of your smtp server here
        String host = "";
        Properties props = new Properties();
        props.put("", host);
        props.put("mail.debug", "true");
        Session session = Session.getInstance(props);
        try {

            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress(from));
            InternetAddress[] address = {new InternetAddress(to)};
            msg.setRecipients(Message.RecipientType.TO, address);
            msg.setSubject("Test E-Mail through Java");
            msg.setContent(msg, "text/plain");
            msg.setSentDate(new Date());
            msg.setText("Test Message");


Thanks in advance


This e-mail and any files transmitted with it are for the sole use of the intended recipient(s)
and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy
all copies of the original message. 
Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of
this email or any action taken in reliance on this e-mail is strictly 
prohibited and may be unlawful.

  Visit us at
View raw message