Package javax.mail

Examples of javax.mail.URLName


      if (m_store == null)
      {
         // kludge for javamaildir/mstor and anyone else needing to specify URLName explicitly
         String sURL = m_conInfo.getProperties().getProperty("mail.store.url");

         m_store = (sURL == null) ? m_session.getStore() : m_session.getStore(new URLName(sURL));
      }

      if (!m_store.isConnected())
      {
         m_store.connect();
View Full Code Here


        String password = "";
        String host = "";
        String protocol = "";
        String port = "";
        URLName urlName;

        for (Iterator iterator = mailParameters.iterator(); iterator.hasNext();) {
            Parameter param = (Parameter) iterator.next();
            String paramKey = param.getName();
            String paramValue = Utils.getParameterValue(param);
            if (paramKey == null || paramValue == null) {
                throw new AxisFault(Messages.getMessage("canNotBeNull",
                                                        "Parameter name nor value should be null"));

            }
            pop3Properties.setProperty(paramKey, paramValue);
            if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_USER)) {
                user = paramValue;
            }
            if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_PASSWORD)) {
                password = paramValue;
            }
            if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_HOST)) {
                host = paramValue;
            }
            if (paramKey.equals(org.apache.axis2.transport.mail.Constants.STORE_PROTOCOL)) {
                protocol = paramValue;
            }
            if (paramKey.equals(org.apache.axis2.transport.mail.Constants.POP3_PORT)) {
                port = paramValue;
            }

        }
        if (password.length() == 0 || user.length() == 0 || host.length() == 0 || protocol.length() == 0) {
            throw new AxisFault("One or more of Password, User, Host and Protocol are null or empty");
        }

        if (port.length() == 0) {
            urlName = new URLName(protocol, host, -1, "", user, password);
        } else {
            urlName = new URLName(protocol, host, Integer.parseInt(port), "", user, password);
        }

        receiver = new EmailReceiver();
        receiver.setPop3Properties(pop3Properties);
        receiver.setUrlName(urlName);
View Full Code Here

            } catch (ContextException ce) {

                // imap://{userid}:{password}@host:port/
                storeURLNameExpanded = getURLNameExpanded(storeURLNameTemplate, userid, password);

                URLName urlNameExpanded = new URLName(storeURLNameExpanded);
                getLogger().info("get store using URLName " + String.valueOf(urlNameExpanded));
                mailStore = mailSession.getStore(urlNameExpanded);
                mailStore.connect();
                mailContext.put(MailContext.MAIL_STORE_ENTRY, mailStore);
            }
View Full Code Here

            } catch (ContextException ce) {

                // imap://{userid}:{password}@host:port/
                storeURLNameExpanded = getURLNameExpanded(storeURLNameTemplate, userid, password);

                URLName urlNameExpanded = new URLName(storeURLNameExpanded);
                getLogger().info("get store using URLName " + String.valueOf(urlNameExpanded));
                mailStore = mailSession.getStore(urlNameExpanded);
                mailStore.connect();
                mailContext.put(MailContext.MAIL_STORE_ENTRY, mailStore);
            }
View Full Code Here

                Iterator i = targetServers.iterator();
                while ( i.hasNext()) {
                    try {
                        String outgoingmailserver = i.next().toString ();
                        log("attempting delivery of " + mail.getName() + " to host " + outgoingmailserver + " to " + Arrays.asList(addr));
                        URLName urlname = new URLName("smtp://" + outgoingmailserver);

                        Properties props = session.getProperties();
                        //This was an older version of JavaMail
                        if (mail.getSender() == null) {
                            props.put("mail.smtp.user", "<>");
View Full Code Here

                //Lookup the possible targets
                for (Iterator i = getMailetContext().getMailServers(host).iterator(); i.hasNext();) {
                    try {
                        String outgoingmailserver = i.next().toString ();
                        log("attempting delivery of " + mail.getName() + " to host " + outgoingmailserver);
                        URLName urlname = new URLName("smtp://" + outgoingmailserver);

                        Properties props = session.getProperties();
                        //This was an older version of JavaMail
                        props.put("mail.smtp.user", mail.getSender().toString());
                        props.put("mail.smtp.from", mail.getSender().toString());
View Full Code Here

    /**
     * Delegates the method to the new URLName class
     */
    public Folder getFolder(String name) throws MessagingException {
        return getFolder(new URLName(name));
    }
View Full Code Here

    msg.setSentDate(new java.util.Date());
    msg.setContent(content,"text/html;charset=big5");
  }

  private void setSMTPServer(String host,int port,  String user,String password) throws Exception{
    tr = new SMTPTransport(sn,new URLName(host));
    tr.connect(host,port,null,null);
   
  }
View Full Code Here

    baseMsg.setSubject("Test Big attached file message");
    baseMsg.setContent(multipart);
        baseMsg.saveChanges();

        log.debug("Send started");
        Transport t = new SMTPTransport(session, new URLName("smtp://localhost:"+SMTP_PORT));
    long started = System.currentTimeMillis();
        t.connect();
        t.sendMessage(baseMsg, new Address[] {new InternetAddress(
        "success@subethamail.org")});
        t.close();
View Full Code Here

        if( File.separatorChar != '/')
        {
            path = path.replace(File.separatorChar, '/');
        }
        path = MboxStore.encodeUrlPath(path);
        return new URLName("mbox", null, -1, path, null, null);
    }
View Full Code Here

TOP

Related Classes of javax.mail.URLName

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.