geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Constantino Jacob" <constantino.ja...@gmail.com>
Subject Re: Problems with the email sending
Date Tue, 22 Aug 2006 03:58:46 GMT
>
> 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 , 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
>
>
>

Mime
View raw message