Examples of MailAccount


Examples of com.centraview.email.MailAccount

       Iterator it = v.iterator();
    HashMap hm = ( HashMap  )it.next();


    MailAccount mailaccount = new MailAccount();

    int AccountID =  ((Long)hm.get( "AccountID" )).intValue() ;

    //System.out.println( "MailAccount" + AccountID );
View Full Code Here

Examples of com.centraview.email.MailAccount


  public MailAccount getAccountDetails( int userid  , HashMap preference )
  {

    MailAccount mailaccount = new MailAccount();
    try
    {

      //System.out.println( "getAccountDetails"+ (Integer)preference.get("AccountID") );
      int accountid = ((Integer)preference.get("AccountID")).intValue();
      System.out.println( "getAccountDetails"+ accountid );

      CVDal cvdl = new CVDal(dataSource);
      Collection v = null;
      cvdl.setSql("email.getemailaccountforedit");
      cvdl.setInt1 , accountid );
      v = cvdl.executeQuery();
      cvdl.clearParameters();
      cvdl.destroy();

      Iterator it = v.iterator();
      HashMap hm = ( HashMap  )it.next();

      int account = ( (Number)hm.get("AccountID")).intValue();

      mailaccount.setAccountID( account );

      String address = (String)hm.get("Address") ;
      //System.out.println( address);
      mailaccount.setAddress( address );

      String leaveonserver = (String)hm.get("LeaveOnServer") ;
      //System.out.println( leaveonserver);
      mailaccount.setLeaveonserver( leaveonserver );

      String login = (String)hm.get("Login") ;
      //System.out.println( login);
      mailaccount.setLogin( login );

      String mailserver = (String)hm.get("mailserver") ;
      //System.out.println( mailserver );
      mailaccount.setMailserver(mailserver);

      String smtpserver = (String)hm.get("SMTPServer") ;
      //System.out.println( mailserver );
      mailaccount.setSmtpserver(smtpserver);

      String port = ((Number)hm.get("Port")).intValue() +"";
      //System.out.println( mailserver );
      mailaccount.setPort(port);

      String name = (String)hm.get("Name") ;
      //System.out.println( name);
      mailaccount.setName(name );

      String password = (String)hm.get("Password") ;
      //System.out.println( password);
      mailaccount.setPassword( password );

      String replyto = (String)hm.get("ReplyTo") ;
      //System.out.println( replyto);
      mailaccount.setReplyto( replyto );

      String servertype = (String)hm.get("ServerType") ;
      //System.out.println( servertype );
      mailaccount.setServertype(servertype );

      String signature = (String)hm.get("Signature") ;
      //System.out.println( signature);
      mailaccount.setSignature( signature );




View Full Code Here

Examples of com.centraview.email.MailAccount

  */
    public MailAccount getAccountDetails( int userid  , HashMap preference ) throws AuthorizationFailedException
    {
    if(!CVUtility.isModuleVisible("Email",userid, this.dataSource))
      throw new AuthorizationFailedException("Email- getAccountDetails");
    MailAccount mailaccount = null;
      try
      {
        InitialContext ic = CVUtility.getInitialContext();
        GetMailLocalHome home = (GetMailLocalHome)ic.lookup("local/GetMail");
        GetMailLocal remote =  home.create();
View Full Code Here

Examples of com.knowgate.hipermail.MailAccount

          DBBind oDBB = (DBBind) getPortletContext().getAttribute("GlobalDBBind");
       
        oCon = oDBB.getConnection("NewMail");
       
        MailAccount oMacc = new MailAccount(oCon, sMailAccount);
       
        if (oMacc.load(oCon, sMailAccount))
          oHnr = new SessionHandler(oMacc);
      else
        oHnr = null;

      oCon.close("NewMail");
View Full Code Here

Examples of com.knowgate.hipermail.MailAccount

      DBStore oStor = null;
      DBFolder oOutBox = null;
      JDCConnection oConn = null;
      PreparedStatement oUpdt = null;
      MailAccount oMacc = new MailAccount();

      if (DebugFile.trace) DebugFile.writeln("workarea="+getStringNull(DB.gu_workarea,"null"));
      String sWrkA = getString(DB.gu_workarea);
      try {
        if (DebugFile.trace) DebugFile.writeln("DBBind="+getDataBaseBind());
        // Get User, Account and Domain objects
        oConn = getDataBaseBind().getConnection("MimeSender.init.1");
        iDomainId = ACLDomain.forWorkArea(oConn, sWrkA);
        if (!oUser.load(oConn, new Object[]{getStringNull(DB.gu_writer,null)})) oUser=null;
        if (!oMacc.load(oConn, new Object[]{getParameter("account")})) oMacc=null;
        // If message is personalized then fill data for each mail address
        oConn.setAutoCommit(true);
        if (bPersonalized) resolveAtomsEMails(oConn);
        oConn.close("MimeSender.init.1");
        oConn=null;
      } catch (SQLException sqle) {
        if (DebugFile.trace) DebugFile.writeln("MimeSender.init("+getStringNull(DB.gu_job,"null")+") " + sqle.getClass().getName() + " " + sqle.getMessage());
        if (oConn!=null) { try { if (!oConn.isClosed()) oConn.close("MimeSender.init.1"); } catch (Exception ignore) {} }
        throw sqle;
      }
        catch (NullPointerException npe) {
        if (DebugFile.trace) DebugFile.writeln("MimeSender.init("+getStringNull(DB.gu_job,"null")+") " + npe.getClass().getName());
        if (oConn!=null) { try { if (!oConn.isClosed()) oConn.close("MimeSender.init.1"); } catch (Exception ignore) {} }
        throw npe;
      }
      if (null==oUser) {
        if (DebugFile.trace) {
          DebugFile.decIdent();
          DebugFile.writeln("End MimeSender.init("+oAtm.getString(DB.gu_job)+") : abnormal process termination");
        }
        throw new NullPointerException("User "+getStringNull(DB.gu_writer,"null")+" not found");
      }
      if (null==oMacc) {
        if (DebugFile.trace) {
          DebugFile.decIdent();
          DebugFile.writeln("End MimeSender.init("+oAtm.getString(DB.gu_job)+") : abnormal process termination");
        }
        throw new NullPointerException("Mail Account "+getParameter("account")+" not found");
      }
      try {

        // Create mail session
        if (DebugFile.trace) DebugFile.writeln("new SessionHandler("+oMacc.getStringNull(DB.gu_account,"null")+")");
        oHndlr = new SessionHandler(oMacc);

        // Retrieve profile name to be used from a Job parameter
        // Profile is needed because it contains the path to /storage directory
        // which is used for composing the path to outbox mbox file containing
View Full Code Here

Examples of com.knowgate.hipermail.MailAccount

               } else {
                 System.out.println("Composing message...");
                 DistributionList oLst = new DistributionList(oCon, oLists.getString(0,0));
                 oLists = null;
                 System.out.println("Getting mail account...");
                 MailAccount oAcc = new MailAccount(oCon, oMaccs.getString(0,0));
                 ACLUser oUsr = new ACLUser(oCon, oAcc.getString(DB.gu_user));
                 System.out.println("Got mail");
                 String sMBoxDir = DBStore.MBoxDirectory(oDbb.getProfileName(),
                                                       oUsr.getInt(DB.id_domain),
                                                       oUsr.getString(DB.gu_workarea));
                 System.out.println("mbox directory is "+sMBoxDir);
                 System.out.println("Opening mail session... ");
                 oHnl = new SessionHandler(oAcc);
        
                 oSto = DBStore.open (oHnl.getSession(), oDbb.getProfileName(), sMBoxDir,
                                      oUsr.getString(DB.gu_user), oUsr.getString(DB.tx_pwd));
                 oFld = oSto.openDBFolder("outbox", DBFolder.READ_WRITE);
                 System.out.println("Creating message template...");
        
                 DBMimeMessage oMsg = DraftsHelper.draftMessage(oFld, oDbb.getProperty("mail.host","127.0.0.1"),
                                                                oUsr.getString(DB.gu_workarea),
                                                                oUsr.getString(DB.gu_user), sType);
                 DraftsHelper.draftUpdate (oCon, oUsr.getInt(DB.id_domain),
                                           oUsr.getString(DB.gu_workarea),
                                           oMsg.getMessageGuid(),
                                           DBCommand.queryStr(oCon, "SELECT "+DB.id_message+" FROM "+DB.k_mime_msgs+
                                             " WHERE "+DB.gu_mimemsg+"='"+oMsg.getMessageGuid()+"'"),
                                           oLst.getString(DB.tx_from),
                                           oLst.getStringNull(DB.tx_reply,oLst.getString(DB.tx_from)),
                                           oLst.getStringNull(DB.tx_sender,oLst.getString(DB.tx_from)),
                                           oLst.getStringNull(DB.tx_subject,""),
                                           "text/"+sType+"; charset=utf-8",
                                           sBody, null, null, null);

                 System.out.println("Message template successfully composed");
                 String sGuJob = null;
                 if (null!=oDbb.getProperty("mail.job.title")) {
                   oStm = oCon.prepareStatement("SELECT "+DB.gu_job+" FROM "+DB.k_jobs+" WHERE "+
                                                DB.tl_job+"=? AND "+DB.gu_workarea+"=?");
                   oStm.setString(1, oDbb.getProperty("mail.job.title"));
                   oStm.setString(2, oLst.getString(DB.gu_workarea));
                   oRst = oStm.executeQuery();
                   if (oRst.next()) sGuJob = oRst.getString(1);
                   oRst.close();
                   oRst=null;
                   oStm.close();
                   oStm=null;
                 } // fi
        
                 if (null==sGuJob) {
                   oSnd = newInstance(oCon, oLst.getString(DB.gu_list),
                                      oLst.getString(DB.gu_workarea),
                                      oUsr.getString(DB.gu_user), dtNow,
                                      Job.STATUS_RUNNING,
                                      oDbb.getProperty("mail.job.title",oLst.getStringNull(DB.de_list,"")+" "+dtNow.toString()),
                                      "profile:"+oDbb.getProfileName()+
                                      ",id:"+oMsg.getMessageID()+
                                      ",message:"+oMsg.getMessageGuid()+
                                      ",account:"+oAcc.getString(DB.gu_account)+
                                      ",gu_list:"+oLst.getString(DB.gu_list)+
                                      ",personalized:"+String.valueOf(true)+
                                      ",bo_attachimages:1");
                 } else {
                   oSnd = new MimeSender();
View Full Code Here

Examples of de.spotnik.mail.core.model.MailAccount

     */
    public MailReaderTest()
    {
        this.reader = (MailReader) CONTEXT.getBean("spotnik.mailReader");
        this.dao = (MailAccountDAO) CONTEXT.getBean("persistence.mailAccountDAO");
        this.account = new MailAccount();
       
        this.account.setHost("imap.web.de");
        this.account.setName("spotnik06");
        this.account.setPassword("spotnik06");
        this.account.setProtocol("imap");
View Full Code Here

Examples of org.projectforge.mail.MailAccount

    final MailAccountConfig cfg = ConfigXml.getInstance().getMebMailAccount();
    if (cfg == null || cfg.getHostname() == null) {
      // No mail account configured.
      return 0;
    }
    final MailAccount mailAccount = new MailAccount(cfg);
    try {
      // If mark messages as seen is set then open mbox read-write.
      mailAccount.connect("INBOX", markRecentMailsAsSeen);
      final Mail[] mails = mailAccount.getMails(filter);
      if (mails != null) {
        for (final Mail mail : mails) {
          final MebEntryDO entry = new MebEntryDO();
          entry.setDate(mail.getDate());
          final String content = mail.getContent();
          final BufferedReader reader = new BufferedReader(new StringReader(content.trim()));
          try {
            StringBuffer buf = null;
            while (reader.ready() == true) {
              final String line = reader.readLine();
              if (line == null) {
                break;
              }
              if (line.startsWith("date=") == true) {
                if (line.length() > 5) {
                  final String dateString = line.substring(5);
                  final Date date = MebDao.parseDate(dateString);
                  entry.setDate(date);
                }
              } else if (line.startsWith("sender=") == true) {
                if (line.length() > 7) {
                  final String sender = line.substring(7);
                  entry.setSender(sender);
                }
              } else if (line.startsWith("msg=") == true) {
                if (line.length() > 4) {
                  final String msg = line.substring(4);
                  buf = new StringBuffer();
                  buf.append(msg);
                }
              } else if (buf != null) {
                buf.append(line);
              } else {
                entry.setSender(line); // First row is the sender.
                buf = new StringBuffer(); // The message follows.
              }
            }
            if (buf != null) {
              entry.setMessage(buf.toString().trim());
            }
          } catch (IOException ex) {
            log.fatal("Exception encountered " + ex, ex);
          }
          if (mebDao.checkAndAddEntry(entry, "MAIL") == true) {
            counter++;
          }
          if (markRecentMailsAsSeen == true) {
            try {
              mail.getMessage().setFlag(Flags.Flag.SEEN, true);
              //mail.getMessage().saveChanges();
            } catch (MessagingException ex) {
              log.error("Exception encountered while setting message flag SEEN as true: " + ex, ex);
            }
          }
          // log.info(mail);
        }
      }
      return counter;
    } finally {
      mailAccount.disconnect();
    }
  }
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.