Package com.googlecode.gmail4j

Examples of com.googlecode.gmail4j.GmailMessage


                    conf.getProxyHost(), conf.getProxyPort());
            ((ProxyAware) connection).setProxyCredentials(
                    conf.getProxyCredentials());
        }
        client.setConnection(connection);
        GmailMessage msg = new JavaMailGmailMessage();
        msg.setSubject("Test mail subject. Unicode: ąžuolėlį");
        msg.setContentText("Test mail content. Unicode: ąžuolėlį");
        msg.addTo(new EmailAddress(conf.getTestRecipient()));
        client.send(msg);
    }
View Full Code Here


            client.setConnection(connection);

            final List<GmailMessage> messages = client.getUnreadMessages();
            if (messages.size() > 0) {
                log.debug("Starting to flag message as starred.");
                GmailMessage gmailMessage = messages.get(0);
                log.debug("Msg Subject: " + gmailMessage.getSubject() + " has "
                        + "been flagged as starred.");
                client.addStar(gmailMessage.getMessageNumber());
                log.debug("Finished flagging message as starred.");
            }
        } catch (final Exception e) {
            log.error("Test Failed", e);
            fail("Caught exception: " + e.getMessage());
View Full Code Here

            client.setConnection(connection);
            client.markAsUnread(1);
            final List<GmailMessage> messages = client.getUnreadMessages();
            if (messages.size() > 0) {
                log.debug("Starting to mark message as read.");
                GmailMessage gmailMessage = messages.get(0);
                log.debug("Msg Subject: " + gmailMessage.getSubject() + " has "
                        + "been marked as read.");
                client.markAsRead(gmailMessage.getMessageNumber());
                log.debug("Finished marking message as read.");
            }
        } catch (final Exception e) {
            log.error("Test Failed", e);
            fail("Caught exception: " + e.getMessage());
View Full Code Here

                    conf.getProxyHost(), conf.getProxyPort());
            ((ProxyAware) connection).setProxyCredentials(
                    conf.getProxyCredentials());
        }
        client.setConnection(connection);
        GmailMessage msg = new JavaMailGmailMessage();
        msg.setSubject("Test mail subject. Unicode: ąžuolėlį");
        msg.setContentText("Test mail content. Unicode: ąžuolėlį");
        msg.addTo(new EmailAddress(conf.getTestRecipient()));
        client.send(msg);
        client.disconnect();
    }
View Full Code Here

            client.setConnection(connection);

            final List<GmailMessage> messages = client.getUnreadMessages();
            if (messages.size() > 0) {
                log.debug("Starting to flag message as starred.");
                GmailMessage gmailMessage = messages.get(0);
                log.debug("Msg Subject: " + gmailMessage.getSubject() + " has "
                        + "been flagged as starred.");
                client.addStar(gmailMessage.getMessageNumber());
                log.debug("Finished flagging message as starred.");
            }
        } catch (final Exception e) {
            log.error("Test Failed", e);
            fail("Caught exception: " + e.getMessage());
View Full Code Here

            client.setConnection(connection);
            client.markAsUnread(1);
            final List<GmailMessage> messages = client.getUnreadMessages();
            if (messages.size() > 0) {
                log.debug("Starting to mark message as read.");
                GmailMessage gmailMessage = messages.get(0);
                log.debug("Msg Subject: " + gmailMessage.getSubject() + " has "
                        + "been marked as read.");
                client.markAsRead(gmailMessage.getMessageNumber());
                log.debug("Finished marking message as read.");
            }
        } catch (final Exception e) {
            log.error("Test Failed", e);
            fail("Caught exception: " + e.getMessage());
View Full Code Here

                connection.setProxyCredentials(conf.getProxyCredentials());
            }
            client.setConnection(connection);
           
            // Send a message so we have one
            GmailMessage msg = new JavaMailGmailMessage();
            msg.setSubject("Test mail subject. Unicode: ąžuolėlį");
            msg.setContentText("Test mail content. Unicode: ąžuolėlį");
            msg.addTo(new EmailAddress(conf.getTestRecipient()));
            client.send(msg);
           
            log.debug("Getting messages");
            final List<GmailMessage> messages = client.getUnreadMessages();
            log.debug("Got " + messages.size() + " messages");
View Full Code Here

                connection.setProxyCredentials(conf.getProxyCredentials());
            }
            client.setConnection(connection);
           
            // Send a message so we have one
            GmailMessage msg = new JavaMailGmailMessage();
            msg.setSubject("Test mail subject. Unicode: ąžuolėlį");
            msg.setContentText("Let's try to write a very long message and see" +
                    "if it will get trimmed when preview is called. It has to " +
                    "be over ? chars long so it will get trimmed. Now this text " +
                    "is over ? chars long, it should really get trimmed good.");
            msg.addTo(new EmailAddress(conf.getTestRecipient()));
            client.send(msg);
           
            log.debug("Getting messages");
            final List<GmailMessage> messages = client.getUnreadMessages();
            log.debug("Got " + messages.size() + " messages");
View Full Code Here

                connection.setProxyCredentials(conf.getProxyCredentials());
            }
            client.setConnection(connection);
           
            // Send a message so we have one
            GmailMessage msg = new JavaMailGmailMessage();
            msg.setSubject(TEST_MAIL_WITH_ATTACHEMENTS_SUBJECT);
            msg.setContentText(TEST_MAIL_WITH_ATTACHEMENT_CONTENT);
            msg.addTo(new EmailAddress(conf.getTestRecipient()));
           
            URL url = this.getClass().getClassLoader().getResource(ATTACHEMENT_1_FILENAME);
            msg.addAttachement(new File(url.toURI()));
            url = this.getClass().getClassLoader().getResource(ATTACHEMENT_2_FILENAME);
            msg.addAttachement(new File(url.toURI()));
            client.send(msg);
           
            final List<GmailMessage> messages = client.getUnreadMessages();
            for (GmailMessage message : messages) {
                if (message.getSubject().equals(TEST_MAIL_WITH_ATTACHEMENTS_SUBJECT)) {
View Full Code Here

TOP

Related Classes of com.googlecode.gmail4j.GmailMessage

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.