Package com.googlecode.gmail4j

Examples of com.googlecode.gmail4j.GmailException


                priorityMessages.add(new JavaMailGmailMessage(msg));
            }
           
            return priorityMessages;
        } catch (final Exception e) {
            throw new GmailException("Failed getting priority messages", e);
        }
    }
View Full Code Here


     * @param name the name of the folder
     * @param store instance of Gmail {@link Store}
     */
    private Folder getFolder(String name, final Store store) {
        if (store == null) {
            throw new GmailException("Gmail IMAP store cannot be null");
        }
        try {
            name = ((name == null) ? this.srcFolder : name);
            Folder folder = store.getFolder(name);
            if (folder.exists()) {
                return folder;
            }
        } catch (final Exception e) {
            throw new GmailException("ImapGmailClient failed getting "
                    + "Folder: " + name, e);
        }

        throw new GmailException("ImapGmailClient Folder name cannot be null");
    }
View Full Code Here

                    gmailImapPort)));
            store.connect(gmailImapHost, getUsername(loginCredentials),
                    new String(loginCredentials.getPasword()));
            setConnected(store.isConnected());
        } catch (final Exception e) {
            throw new GmailException("Failed opening Gmail IMAP store", e);
        }
        return store;
    }
View Full Code Here

                    gmailSmtpPort)));
            transport.connect(loginCredentials.getUsername(),
                    new String(loginCredentials.getPasword()));
            return transport;
        } catch (final Exception e) {
            throw new GmailException("ImapGmailClient requires ImapGmailConnection!");
        }
    }
View Full Code Here

            }
            if (log.isDebugEnabled()) {
                log.debug("Got " + messages.size() + " new messages.");
            }
        } catch (final Exception e) {
            throw new GmailException("Failed getting unread messages", e);
        }
        return messages;
    }
View Full Code Here

     */
    private HttpGmailConnection getGmailConnection() {
        if (connection instanceof HttpGmailConnection) {
            return (HttpGmailConnection) connection;
        }
        throw new GmailException("RssGmailClient requires HttpGmailConnection!");
    }
View Full Code Here

                found.add(new JavaMailGmailMessage(msg));
            }
            LOG.debug("Found " + found.size() + " emails");
            return found;
        } catch (final Exception e) {
            throw new GmailException("Failed getting unread messages", e);
        }
    }
View Full Code Here

     */
    private Store openGmailStore() {
        if (connection instanceof ImapGmailConnection) {
            return ((ImapGmailConnection) connection).openGmailStore();
        }
        throw new GmailException("ImapGmailClient requires ImapGmailConnection!");
    }
View Full Code Here

     */
    private Transport getGmailTransport() {
        if (connection instanceof ImapGmailConnection) {
            return ((ImapGmailConnection) connection).getTransport();
        }
        throw new GmailException("ImapGmailClient requires ImapGmailConnection!");
    }
View Full Code Here

                transport = getGmailTransport();
                transport.sendMessage(
                        msg.getMessage(),
                        msg.getMessage().getAllRecipients());
            } catch (final Exception e) {
                throw new GmailException("Failed sending message: " + message, e);
            }
            finally{
                if(transport.isConnected())
                {
                    try {
                        transport.close();
                    } catch (final Exception e) {
                        LOG.warn("Cannot Close ImapGmailConnection : " + transport, e);
                    }
                }
            }
        } else {
            throw new GmailException("ImapGmailClient requires JavaMailGmailMessage!");
        }
    }
View Full Code Here

TOP

Related Classes of com.googlecode.gmail4j.GmailException

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.