Fabio Rossi wrote:
> Here's sendMail method:
>
> Properties props = new ConfigLoader().loadConfigFile();
> String prop;
> prop=(String)props.get("summary_header");
> if(prop!=null)
> summary=prop+"\n"+summary;
> prop= (String) props.get("mail.smtp.host");
> props.put( "mail.smtp.host",prop);
> prop= (String) props.get("mail.smtp.port");
> props.put("mail.smtp.port",prop);
> Session session = Session.getDefaultInstance(props);
> Message message = new MimeMessage( session );
>
> InternetAddress from = new InternetAddress((String)
> props.get("internet_address"));
> InternetAddress to[] = InternetAddress.parse( userEmail );
>
> message.setFrom( from );
> message.setRecipients( Message.RecipientType.TO, to );
> message.setSubject((String)props.getProperty("subject"));
> message.setSentDate( new Date() );
> message.setText( summary );
> Transport.send(message);
Detail questions;
- are you certain that the ConfigLoader actually loads the relevant
configuration (adding some logging lines to the code would help in
seeing what is going on)?
- the processing of mail.smtp.host and mail.smtp.port seem to be "no
action" for me: you're retrieving the entries from the same properties
object to which you're storing them -- should you be retrieving them
from some other place (such as system properties)?
--
..Juha
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]