Package javax.mail

Examples of javax.mail.Store.connect()


    private void prepareMailbox() throws Exception {
        // connect to mailbox
        Mailbox.clearAll();
        JavaMailSender sender = new DefaultJavaMailSender();
        Store store = sender.getSession().getStore("pop3");
        store.connect("localhost", 25, "jones", "secret");
        Folder folder = store.getFolder("INBOX");
        folder.open(Folder.READ_WRITE);
        folder.expunge();

        // inserts 5 new messages
View Full Code Here


public class JavaMailConnection extends JavaMailSenderImpl {

    public Folder getFolder(String protocol, String folderName) {
        try {
            Store store = getSession().getStore(protocol);
            store.connect(getHost(), getPort(), getUsername(), getPassword());
            return store.getFolder(folderName);
        }
        catch (MessagingException e) {
            throw new MailSendException("Mail server connection failed", e);
        }
View Full Code Here

    private void prepareMailbox() throws Exception {
        // connect to mailbox
        Mailbox.clearAll();
        JavaMailSenderImpl sender = new JavaMailSenderImpl();
        Store store = sender.getSession().getStore("pop3");
        store.connect("localhost", 25, "jones", "secret");
        Folder folder = store.getFolder("INBOX");
        folder.open(Folder.READ_WRITE);
        folder.expunge();

        // inserts 8 new messages
View Full Code Here

    //     Get session
        Session session = Session.getDefaultInstance(new Properties(), null);
   
    //     Get the store
        Store store = session.getStore("pop3");
        store.connect("pop.free.fr", "drighetto", "3eruvrjp");
   
    //     Get folder
        Folder folder = store.getFolder("INBOX");
        folder.open(Folder.READ_WRITE);
   
View Full Code Here

            Store st = sess.getStore("imap");

            AttributesImpl attr = new AttributesImpl();

            log("Connecting to IMAP server @ " + this.host);
            st.connect(this.host, this.user, this.pass);

            log("Attempting to open default folder");
            Folder f = st.getFolder("inbox");

            f.open(Folder.READ_WRITE);
View Full Code Here

                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);
            }
        } catch (Exception e) {
            String message = "Cannot get store, and connect " + String.valueOf(storeURLNameExpanded);
            getLogger().error(message, e);
View Full Code Here

            // Connect
            if (getHost() != null
                || getUser() != null
                || getPassword() != null)
                store.connect(getHost(), getUser(), getPassword());
            else
                store.connect();

            // Get the Folder
            folder = store.getFolder(getJavaMailFolderName());
View Full Code Here

            if (getHost() != null
                || getUser() != null
                || getPassword() != null)
                store.connect(getHost(), getUser(), getPassword());
            else
                store.connect();

            // Get the Folder
            folder = store.getFolder(getJavaMailFolderName());
            if (folder == null)
                getLogger().error(getFetchTaskName() + " No default folder");
View Full Code Here

    private void prepareMailbox(String user, String type) throws Exception {
        // connect to mailbox
        JavaMailSenderImpl sender = new JavaMailSenderImpl();
        Store store = sender.getSession().getStore(type);
        store.connect("localhost", 25, user, "secret");
        Folder folder = store.getFolder("INBOX");
        folder.open(Folder.READ_WRITE);
        folder.expunge();

        InputStream is = getClass().getResourceAsStream("/SignedMailTestCaseHurz.elm");
View Full Code Here

    private void prepareMailbox() throws Exception {
        // connect to mailbox
        Mailbox.clearAll();
        JavaMailSenderImpl sender = new JavaMailSenderImpl();
        Store store = sender.getSession().getStore("pop3");
        store.connect("localhost", 25, "jones", "secret");
        Folder folder = store.getFolder("INBOX");
        folder.open(Folder.READ_WRITE);
        folder.expunge();

        // inserts 8 new messages
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.