Package javax.mail

Examples of javax.mail.URLName


                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                smtpTrans.connect();
                smtpTrans.sendMessage(msg, msg.getAllRecipients());
                smtpTrans.close();
            } else {
View Full Code Here


                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                smtpTrans.connect();
                smtpTrans.sendMessage(msg, msg.getAllRecipients());
                smtpTrans.close();
            }
View Full Code Here

                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                sendMessage(smtpTrans, msg);
            }
        }
View Full Code Here

                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                smtpTrans.connect();
                smtpTrans.sendMessage(msg, msg.getAllRecipients());
                smtpTrans.close();
            } else {
View Full Code Here

                msg.setContent(content, "text/plain");
                msg.saveChanges();

                SMTPTransport smtpTrans = null;
                if (_smtpUseAuth) {
                    smtpTrans = new SMTPSSLTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                } else {
                    smtpTrans = new SMTPTransport(_smtpSession, new URLName("smtp", _smtpHost, _smtpPort, null, _smtpUsername, _smtpPassword));
                }
                smtpTrans.connect();
                smtpTrans.sendMessage(msg, msg.getAllRecipients());
                smtpTrans.close();
            }
View Full Code Here

    private void importMails(GlobalUser user) throws MessagingException {
        logger.debug("Importing mail for " + user.getUsername());
        Properties properties = new Properties();
        Session session = Session.getInstance(properties);
        Store store =
                session.getStore(new URLName("pop3://" + user.getUsername()
                        + ":" + user.getPassword() + "@" + remoteHost + ":"
                        + +remotePort + "/INBOX"));
        store.connect();
        Folder folder = store.getFolder("INBOX");
        folder.open(Folder.READ_WRITE);
View Full Code Here

        if (pass != null)
        {
            pass = URLDecoder.decode(pass, endpoint.getEncoding());
        }

        return new URLName(uri.getScheme(), uri.getHost(), uri.getPort(), inbox, user, pass);
    }
View Full Code Here

        local.setProperty("mail." + getBaseProtocol() + ".rsetbeforequit", "true");
    }

    protected SessionDetails newSession(ImmutableEndpoint endpoint) throws UnsupportedEncodingException
    {
        URLName url = urlFromEndpoint(endpoint);

        Properties global = System.getProperties();
        Properties local = new Properties();
        //Allow properties to be set on the endpoint
        PropertiesUtils.getPropertiesWithPrefix(endpoint.getProperties(), "mail.", local);
        Session session;

        // make sure we do not mess with authentication set via system properties
        synchronized (global)
        {
            extendPropertiesForSession(global, local, url);
            session = Session.getInstance(local, getAuthenticator());
        }

        if (logger.isDebugEnabled())
        {
            local.setProperty("mail.debug", "true");
           
            dumpProperties("MuleSession local properties", local, true);
            dumpProperties("System global properties", global, true);
            logger.debug("Creating mail session: host = " + url.getHost() + ", port = " + url.getPort()
                + ", user = " + url.getUsername() + ", pass = " + url.getPassword());
        }

        return new SessionDetails(session, url);
    }
View Full Code Here

    }

    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

        }

        public void sendMessages() throws MessagingException {
            Transport transport = null;
            try {
                URLName url = new URLName("smtp", host, port, "", username, password);
                if (session == null) {
                    createSession();
                }
                transport = new com.sun.mail.smtp.SMTPTransport(session, url);
                transport.connect(host, port, username, password);
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.