Search in sources :

Example 1 with ReadmailProtocol

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

the class JavaMailAckReaderIT method updateConfigWithGoogleReadConfiguration.

private void updateConfigWithGoogleReadConfiguration(ReadmailConfig config, String gmailAccount, String gmailPassword) {
    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);
}
Also used : ReadmailProtocol(org.opennms.netmgt.config.javamail.ReadmailProtocol) ReadmailHost(org.opennms.netmgt.config.javamail.ReadmailHost) UserAuth(org.opennms.netmgt.config.javamail.UserAuth)

Example 2 with ReadmailProtocol

use of org.opennms.netmgt.config.javamail.ReadmailProtocol 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)2 ReadmailProtocol (org.opennms.netmgt.config.javamail.ReadmailProtocol)2 UserAuth (org.opennms.netmgt.config.javamail.UserAuth)2 ReadmailConfig (org.opennms.netmgt.config.javamail.ReadmailConfig)1