Package javax.mail

Examples of javax.mail.URLName


            } 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


    hr.request.log(Server.LOG_DIAGNOSTIC,connHandle,"server = " + server);
    hr.request.log(Server.LOG_DIAGNOSTIC,connHandle,"port = " + port);

    /* Create our URLName for the server connection */

    serverURL = new URLName("imap://" + user + "@" + server + ":" + port);

    hr.request.log(Server.LOG_DIAGNOSTIC,connHandle,"serverURL = " + serverURL.toString());

    pa = new PasswordAuthentication(user,hr.get("password"));

View Full Code Here

     * <p>For example, {@code imap://john:secret@imap.example.com/INBOX}
     *
     * @see Session#getStore(URLName)
     */
    public void setStoreUri(String storeUri) {
        this.storeUri = new URLName(storeUri);
    }
View Full Code Here

     * <p>For example, {@code smtp://john:secret@smtp.example.com}
     *
     * @see Session#getTransport(URLName)
     */
    public void setTransportUri(String transportUri) {
        this.transportUri = new URLName(transportUri);
    }
View Full Code Here

     * <p>For example, {@code imap://john:secret@imap.example.com/INBOX}
     *
     * @see Session#getStore(URLName)
     */
    public void setStoreUri(String storeUri) {
        this.storeUri = new URLName(storeUri);
    }
View Full Code Here

     * <p>For example, {@code smtp://john:secret@smtp.example.com}
     *
     * @see Session#getTransport(URLName)
     */
    public void setTransportUri(String transportUri) {
        this.transportUri = new URLName(transportUri);
    }
View Full Code Here

public class MailTransportUtilsTest {

    @Test
    public void testToPasswordProtectedString() throws Exception {
        URLName name = new URLName("imap://john:secret@imap.example.com/INBOX");
        String result = MailTransportUtils.toPasswordProtectedString(name);
        Assert.assertEquals("Password found in string", -1, result.indexOf("secret"));
    }
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

    props.put(XoauthSaslClientFactory.CONSUMER_SECRET_PROP,
              consumer.consumerSecret);
    Session session = Session.getInstance(props);
    session.setDebug(debug);

    final URLName unusedUrlName = null;
    IMAPSSLStore store = new IMAPSSLStore(session, unusedUrlName);
    final String emptyPassword = "";
    store.connect(host, port, userEmail, emptyPassword);
    return store;
  }
View Full Code Here

    props.put("mail.smtp.starttls.required", "true");
    props.put("mail.smtp.sasl.enable", "false");
    Session session = Session.getInstance(props);
    session.setDebug(debug);

    final URLName unusedUrlName = null;
    SMTPTransport transport = new SMTPTransport(session, unusedUrlName);
    // If the password is non-null, SMTP tries to do AUTH LOGIN.
    final String emptyPassword = null;
    transport.connect(host, port, userEmail, emptyPassword);
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.