Package com.google.code.lightssh.common.model

Examples of com.google.code.lightssh.common.model.ConnectionConfig


   
    Map<String,SystemParam> paramMap = new HashMap<String,SystemParam>();
    for( SystemParam item:params )
      paramMap.put(item.getName(), item);
   
    ConnectionConfig config = new ConnectionConfig();
   
    config.setHost( getParamValue(
        paramMap,MailConfigConstants.EMAIL_HOST_KEY));
   
    config.setPort( getParamValue(
        paramMap,MailConfigConstants.EMAIL_PORT_KEY ) );
   
    config.setUsername(getParamValue(
        paramMap,MailConfigConstants.EMAIL_USERNAME_KEY ) );
   
    config.setPassword(getParamValue(
        paramMap,MailConfigConstants.EMAIL_PASSWORD_KEY ) );
   
    config.setSsl( "true".equalsIgnoreCase(getParamValue(
        paramMap,MailConfigConstants.EMAIL_SSL_KEY ) ));
   
    return config;
  }
View Full Code Here


 
  @Resource(name="emailContentManager")
  private EmailContentManager emailContentManager;
 
  protected ConnectionConfig getEmailConnectionConfig( ){
    ConnectionConfig config = null;
   
    if( systemParamManager != null ){
      config = systemParamManager.getEmailConnectionConfig();
    }
   
    if( systemConfig == null )
      return config;
   
    if( config == null ){
      config = new ConnectionConfig();
     
      config.setHost( this.systemConfig.getProperty(
          MailConfigConstants.EMAIL_HOST_KEY ) );
     
      config.setPort( this.systemConfig.getProperty(
          MailConfigConstants.EMAIL_PORT_KEY ) );
     
      config.setUsername( this.systemConfig.getProperty(
          MailConfigConstants.EMAIL_USERNAME_KEY ) );
     
      config.setPassword( this.systemConfig.getProperty(
          MailConfigConstants.EMAIL_PASSWORD_KEY ) );
     
      config.setSsl( "true".equalsIgnoreCase(systemConfig.getProperty(
          MailConfigConstants.EMAIL_SSL_KEY ) ));
    }
   
    return config;
  }
View Full Code Here

 
  /**
   * 发邮件
   */
  public void send(EmailContent ec ){
    ConnectionConfig config = getEmailConnectionConfig();
   
    MailAddress mailAddress = new MailAddress( );
    mailAddress.setFrom(config.getUsername(),config.getUsername());
   
    for( String item:ec.getAddressees())
      mailAddress.addTo(item, "");
   
    if( !StringUtils.isEmpty(ec.getCc()) ){
      for( String item:ec.getCcs())
        mailAddress.addCc(item, "");
    }
   
    boolean success = false;
    try{
      mailSender.sendHtml(config,mailAddress
          ,new MailContent(ec.getSubject(),ec.getContent()));
      success = true;
    }catch( Exception e ){
      ec.setErrMsg( TextFormater.format(e.getMessage(),197,true) );
    }
   
    ec.setSender( config.getUsername() );
   
    emailContentManager.updateStatus(success,ec);
  }
View Full Code Here

 
  /**
   * 忘记用户名
   */
  public void forgotUsername(String title, String email ){
    ConnectionConfig config = getEmailConnectionConfig();
    Address to = new Address(email,title);
    Address from = new Address(config.getUsername(),config.getUsername());
    MailAddress mailAddress = new MailAddress( to,from );
   
    StringBuffer content = new StringBuffer();
    content.append("您在系统的登录帐号为:" + title);
   
View Full Code Here

   */
  public void forgotPassword(String retrieveUrl, LoginAccount account ){
    if( account == null || StringUtils.isEmpty(account.getEmail()) )
      return ;
   
    ConnectionConfig config = getEmailConnectionConfig();
    Address to = new Address(account.getEmail(),account.getLoginName());
    Address from = new Address(config.getUsername(),config.getUsername());
    MailAddress mailAddress = new MailAddress( to,from );
   
    StringBuffer content = new StringBuffer();
    content.append("<html>");
    //content.append("<img src=\"http://www.gstatic.com/codesite/ph/images/defaultlogo.png\"></br>");
View Full Code Here

TOP

Related Classes of com.google.code.lightssh.common.model.ConnectionConfig

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.