return true;
}
try {
Properties props = new Properties();
final IEmailService service =
PentahoSystem.get( IEmailService.class, "IEmailService", PentahoSessionHolder.getSession() );
props.put( "mail.smtp.host", service.getEmailConfig().getSmtpHost() );
props.put( "mail.smtp.port", ObjectUtils.toString( service.getEmailConfig().getSmtpPort() ) );
props.put( "mail.transport.protocol", service.getEmailConfig().getSmtpProtocol() );
props.put( "mail.smtp.starttls.enable", ObjectUtils.toString( service.getEmailConfig().isUseStartTls() ) );
props.put( "mail.smtp.auth", ObjectUtils.toString( service.getEmailConfig().isAuthenticate() ) );
props.put( "mail.smtp.ssl", ObjectUtils.toString( service.getEmailConfig().isUseSsl() ) );
props.put( "mail.smtp.quitwait", ObjectUtils.toString( service.getEmailConfig().isSmtpQuitWait() ) );
props.put( "mail.from.default", service.getEmailConfig().getDefaultFrom() );
String fromName = service.getEmailConfig().getFromName();
if ( StringUtils.isEmpty( fromName ) ) {
fromName = Messages.getInstance().getString( "schedulerEmailFromName" );
}
props.put( "mail.from.name", fromName );
props.put( "mail.debug", ObjectUtils.toString( service.getEmailConfig().isDebug() ) );
Session session;
if ( service.getEmailConfig().isAuthenticate() ) {
props.put( "mail.userid", service.getEmailConfig().getUserId() );
props.put( "mail.password", service.getEmailConfig().getPassword() );
Authenticator authenticator = new EmailAuthenticator();
session = Session.getInstance( props, authenticator );
} else {
session = Session.getInstance( props );
}
// debugging is on if either component (xaction) or email config debug is on
if ( service.getEmailConfig().isDebug() || ComponentBase.debug ) {
session.setDebug( true );
}
// construct the message
MimeMessage msg = new MimeMessage( session );