Examples of IEmailService


Examples of org.pentaho.platform.api.email.IEmailService

  }

  @Override
  protected boolean validateSystemSettings() {

    final IEmailService service =
        PentahoSystem.get( IEmailService.class, "IEmailService", PentahoSessionHolder.getSession() );
    String mailhost = service.getEmailConfig().getSmtpHost();
    boolean authenticate = service.getEmailConfig().isAuthenticate();
    defaultFrom = service.getEmailConfig().getDefaultFrom();
    String user = service.getEmailConfig().getUserId();
    String password = service.getEmailConfig().getPassword();

    // Check the email server settings...
    if ( mailhost.equals( "" ) || ( user.equals( "" ) && authenticate ) || defaultFrom.equals( "" ) ) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      // looks like the email stuff is not configured yet...
      // see if we can provide feedback to the user...
View Full Code Here

Examples of org.pentaho.platform.api.email.IEmailService

      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 );
View Full Code Here

Examples of org.pentaho.platform.api.email.IEmailService

    props.put( "body", body );
  }

  public boolean setup() {
    try {
      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() ) );

      if ( service.getEmailConfig().isAuthenticate() ) {
        props.put( "mail.userid", service.getEmailConfig().getUserId() );
        props.put( "mail.password", service.getEmailConfig().getPassword() );
        setAuthenticator( new Authenticator() {
          protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication( service.getEmailConfig().getUserId(), service.getEmailConfig()
                .getPassword() );
          }
        } );
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.