Search in sources :

Example 6 with ReadmailHost

use of org.opennms.netmgt.config.javamail.ReadmailHost in project opennms by OpenNMS.

the class JavaReadMailerTest method createGoogleReadMailer.

private JavaReadMailer createGoogleReadMailer(String gmailAccount, String gmailPassword) throws JavaMailerException {
    ReadmailConfig config = new ReadmailConfig();
    config.setDebug(true);
    config.setDeleteAllMail(false);
    config.setMailFolder("INBOX");
    ReadmailHost readmailHost = new ReadmailHost();
    readmailHost.setHost("imap.gmail.com");
    readmailHost.setPort(993);
    ReadmailProtocol readmailProtocol = new ReadmailProtocol();
    readmailProtocol.setSslEnable(true);
    readmailProtocol.setStartTls(false);
    readmailProtocol.setTransport("imaps");
    readmailHost.setReadmailProtocol(readmailProtocol);
    config.setReadmailHost(readmailHost);
    UserAuth userAuth = new UserAuth();
    userAuth.setPassword(gmailPassword);
    userAuth.setUserName(gmailAccount);
    config.setUserAuth(userAuth);
    JavaReadMailer mailer = new JavaReadMailer(config, true);
    return mailer;
}
Also used : ReadmailProtocol(org.opennms.netmgt.config.javamail.ReadmailProtocol) ReadmailConfig(org.opennms.netmgt.config.javamail.ReadmailConfig) ReadmailHost(org.opennms.netmgt.config.javamail.ReadmailHost) UserAuth(org.opennms.netmgt.config.javamail.UserAuth)

Aggregations

ReadmailHost (org.opennms.netmgt.config.javamail.ReadmailHost)6 UserAuth (org.opennms.netmgt.config.javamail.UserAuth)6 Message (javax.mail.Message)3 Folder (javax.mail.Folder)2 MessagingException (javax.mail.MessagingException)2 NoSuchProviderException (javax.mail.NoSuchProviderException)2 ReadmailConfig (org.opennms.netmgt.config.javamail.ReadmailConfig)2 ReadmailProtocol (org.opennms.netmgt.config.javamail.ReadmailProtocol)2 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Store (javax.mail.Store)1 JavaReadMailer (org.opennms.javamail.JavaReadMailer)1 JavamailProperty (org.opennms.netmgt.config.javamail.JavamailProperty)1