Package javax.mail

Examples of javax.mail.PasswordAuthentication


          if(smtp_port>0 && smtp_port!=25)
              mailProperties.put("mail.smtp.port", String.valueOf(smtp_port));
          mailProperties.put("mail.smtp.auth", "true"); //����smtp��֤���ܹؼ���һ��
          mailSession = Session.getDefaultInstance(mailProperties, new Authenticator(){
        protected PasswordAuthentication getPasswordAuthentication() {
              return new PasswordAuthentication(smtp_user, smtp_pass);
        }});
    }
    else{
          Properties props = new Properties();
          //Not needed for production environment
View Full Code Here


    /**
     * ����ʵ���ʼ������û���֤
     * @see javax.mail.Authenticator#getPasswordAuthentication
     */
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(username, userpasswd);
    }
View Full Code Here

{
  private PasswordAuthentication auth = null;
 
  public UsernamePasswordAuthenticator(String user, String password)
  {
    auth = new PasswordAuthentication(user, password);
  }
View Full Code Here

  {
    final String protocol = getRequestingProtocol();

    final String userName = properties.getProperty("mail." + protocol + ".user", properties.getProperty("mail.user"));
    final String password = properties.getProperty("mail." + protocol + ".password", properties.getProperty("mail.password"));
    return new PasswordAuthentication(userName, password);
  }
View Full Code Here

  {
    protected PasswordAuthentication getPasswordAuthentication()
    {
      if (mUser != null)
      {
        return new PasswordAuthentication(mUser, mPassword);
      }
      else
      {
        return null;
      }
View Full Code Here

                 pluginConfig));
        p = props.getProperty("mail.smtp.connectiontimeout");
        this.smtpConnectionTimeout = new Integer(p).intValue();

      // Pass "this" for SMTP authentication with Authenticator
      this.authentication = new PasswordAuthentication(getUser(), this.xbUri.getPassword());
      this.session = Session.getDefaultInstance(props, this);
      this.isInitialized = true;
     
      // Setup asynchronous sending thread for outgoing emails
      this.asyncSendQueueSizeMax = glob.get("asyncSendQueueSizeMax",
View Full Code Here

      try {
         this.xbUri = new XbUri(this.pop3Url);
         if (this.xbUri.getPassword() != null) {
            this.props.setProperty("mail.smtp.auth", "true"); //Indicate that authentication is required at pop3 server
            this.authentication = new PasswordAuthentication(this.xbUri.getUser(), this.xbUri.getPassword());
         }
      } catch (URISyntaxException e) {
         throw new XmlBlasterException(glob,
               ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, "Pop3Driver",
               "Your URI '" + this.pop3Url +
View Full Code Here

         synchronized (this) {
            if (this.session == null) { // In such a case we should better throw an exception (the session should be initialized?!)
               Thread.dumpStack();
               if (this.xbUri != null && this.xbUri.getPassword() != null) {
                  this.props.setProperty("mail.smtp.auth", "true"); //Indicate that authentication is required at pop3 server
                  this.authentication = new PasswordAuthentication(this.xbUri.getUser(), this.xbUri.getPassword());
               }
               this.session = Session.getInstance(this.props, this);
            }
         }
      }
View Full Code Here

public class SilentAuthenticator extends Authenticator {
  private PasswordAuthentication oPwdAuth;

  public SilentAuthenticator(String sUserName, String sAuthStr) {
    oPwdAuth = new PasswordAuthentication(sUserName, sAuthStr);
  }
View Full Code Here

     * Called when password authentication is needed.
     * @return a password authentication
     */
    @Override
    public PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(username, password);
    }
View Full Code Here

TOP

Related Classes of javax.mail.PasswordAuthentication

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.