Package javax.mail

Examples of javax.mail.URLName


    }
    boolean sentSuccessfully = false;
    while ( !sentSuccessfully && urlnIt.hasNext() )
    {
      try {
        URLName outgoingMailServer = urlnIt.next();
        AspirinInternal.getLogger().debug("SendMessage.handle(): Attempting delivery of '{}' to recipient '{}' on host '{}' ",new Object[]{dCtx.getQueueInfo().getMailid(),dCtx.getQueueInfo().getRecipient(),outgoingMailServer});
        Properties props = session.getProperties();
        if (message.getSender() == null) {
          props.put("mail.smtp.from", "<>");
        } else {
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

                recordsColl = new Vector<URLName>(records.length);
                for (int i = 0; i < records.length; i++)
        {
          MXRecord mx = (MXRecord) records[i];
          String targetString = mx.getTarget().toString();
          URLName uName = new URLName(
              SMTP_PROTOCOL_PREFIX +
              targetString.substring(0, targetString.length() - 1)
          );
          recordsColl.add(uName);
        }
            }else
            {
              foundOriginalMX = false;
              recordsColl = new Vector<URLName>();
            }
           
            /*
             * If we found no MX record for the original hostname (the upper
             * level domains does not matter), then we add the original domain
             * name (identified with an A record) to the record collection,
             * because the mail exchange server could be the main server too.
       *
       * We append the A record to the first place of the record
       * collection, because the standard says if no MX record found then
       * we should to try send email to the server identified by the A
       * record.
             */
      if( !foundOriginalMX )
      {
        Record[] recordsTypeA = new Lookup(hostName, Type.A).run();
        if (recordsTypeA != null && recordsTypeA.length > 0)
        {
          recordsColl.add(0, new URLName(SMTP_PROTOCOL_PREFIX + hostName));
        }
      }

    } catch (TextParseException e) {
      AspirinInternal.getConfiguration().getLogger().warn("DnsResolver.getMXRecordsForHost(): Failed get MX record for host '"+hostName+"'.",e);
View Full Code Here

   * @param url URL in the format </code>protocol://user[:password]@server[:port]</code>
   * @return Mail Store for the connection
   * @throws MessagingException
   */
  private Store openConnection(String url) throws MessagingException {
    URLName urlName = new URLName(url);
    log.debug("opening " + urlName.getProtocol() + " conection to " + urlName.getHost());
    Properties props = new Properties();
    Session session = Session.getDefaultInstance(props);
    Store store = session.getStore(urlName);
    store.connect();

View Full Code Here

      protocol = "imaps";
    } else {
      protocol = "imap";
    }

    URL = new URLName(protocol, textServer.getText().trim(), -1, null, textUsername.getText().trim(), textPassword
        .getText().trim());
    this.dispose();
  }
View Full Code Here

    return URL.toString();
  }

  public void setURL(String url) {
    try {
      URL = new URLName(url);
      textUsername.setText(URL.getUsername());
      textPassword.setText(URL.getPassword());
      textServer.setText(URL.getHost());
      if (URL.getProtocol().equals("imaps")) {
        radioSSLYes.setSelected(true);
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

  // ---------------------------------------------------------------------------

  public URLName getURL() {
    if (null==oURLSession) {
      oURLSession = new URLName("jdbc://", sInHostName, -1, sMBoxDir, sInAccountName, sInAuthStr);
    }
    return oURLSession;
  }
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

    @Test
    public void testNullUsernameAndPassword() throws Exception
    {
        OutboundEndpoint endpoint = muleContext.getEndpointFactory().getOutboundEndpoint("smtp://localhost:23");
        URLName name = ((AbstractMailConnector)getConnector()).urlFromEndpoint(endpoint);
        assertNull(name.getUsername());
        assertNull(name.getPassword());

        endpoint = muleContext.getEndpointFactory().getOutboundEndpoint("smtp://george@localhost:23");
        name = ((AbstractMailConnector)getConnector()).urlFromEndpoint(endpoint);
        assertEquals("george", name.getUsername());
        assertNull(name.getPassword());
    }
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.