Package javax.mail

Examples of javax.mail.Authenticator


                        }

                        props.put(attr.getType(), (String) attr.getContent());
                    }

                    Authenticator auth = null;
                    if (password != null) {
                        String user = props.getProperty("mail.smtp.user");
                        if(user == null) {
                            user = props.getProperty("mail.user");
                        }
                       
                        if(user != null) {
                            final PasswordAuthentication pa = new PasswordAuthentication(user, password);
                            auth = new Authenticator() {
                                    protected PasswordAuthentication getPasswordAuthentication() {
                                        return pa;
                                    }
                                };
                        }
View Full Code Here


      props.put("mail.smtp.host", smtphost);
      props.put("mail.smtp.port", smptPort);
     
      props.put("mail.smtp.auth", "true");
      // create autheticator object
      Authenticator auth = new SMTPAuthenticator(user, pass);
      // open session
      Session session = Session.getDefaultInstance(props, auth);
      // create a message
      Message msg = new MimeMessage(session);
      // set the from and to address
View Full Code Here

      //Set the host smtp address
      Properties props = new Properties();
      props.put("mail.smtp.host", smtphost);
      props.put("mail.smtp.auth", "true");
      // create autheticator object
      Authenticator auth = new SMTPAuthenticator(user, pass);
      // open session
      Session session = Session.getDefaultInstance(props, auth);
      // create a message
      Message msg = new MimeMessage(session);
      // set the from and to address
View Full Code Here

      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

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

    emailProperties.setProperty( "mail.smtp.ssl", ObjectUtils.toString( emailConfig.isUseSsl() ) );
    emailProperties.setProperty( "mail.debug", ObjectUtils.toString( emailConfig.isDebug() ) );

    Session session = null;
    if ( emailConfig.isAuthenticate() ) {
      Authenticator authenticator = new Authenticator() {
        @Override
        protected PasswordAuthentication getPasswordAuthentication() {
          return new PasswordAuthentication( emailConfig.getUserId(), emailConfig.getPassword() );
        }
      };
View Full Code Here

        }

        MimeMultipart mp = null;

        try {
            Authenticator auth = new SMTPAuthenticator();
            Session session = Session.getDefaultInstance(props, auth);
            session.setDebug(runtime.getDebug());

            MimeMessage msg = new MimeMessage(session);
View Full Code Here

      props.put("mail.smtp.host", smtphost);
      props.put("mail.smtp.port", smptPort);
      props.put("mail.smtp.auth", "true");
      logger.debug("properties: mail.smtp.host:"+smtphost+" mail.smtp.port:"+smtpport);
      // create autheticator object
      Authenticator auth = new SMTPAuthenticator(login, pass);
      // open session
      Session session = Session.getDefaultInstance(props, auth);

      // create a message
      Message msg = new MimeMessage(session);
View Full Code Here

        props.put("mail.smtp.host", smtphost);
        props.put("mail.smtp.port", smptPort);
        props.put("mail.smtp.auth", "true");
       
// create autheticator object
        Authenticator auth = new SMTPAuthenticator(user, pass);
       
// open session
        Session session = Session.getDefaultInstance(props, auth);
       
// create a message
View Full Code Here

                        }

                        props.put(attr.getType(), (String) attr.getContent());
                    }

                    Authenticator auth = null;
                    if (password != null) {
                        String user = props.getProperty("mail.smtp.user");
                        if(user == null) {
                            user = props.getProperty("mail.user");
                        }
                       
                        if(user != null) {
                            final PasswordAuthentication pa = new PasswordAuthentication(user, password);
                            auth = new Authenticator() {
                                    protected PasswordAuthentication getPasswordAuthentication() {
                                        return pa;
                                    }
                                };
                        }
View Full Code Here

TOP

Related Classes of javax.mail.Authenticator

Copyright © 2018 www.massapicom. 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.