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;
}
Aggregations