/** <i>Description:</i> */ private void getSmtpSettingsFromDb() { MailProperties mailProperties = subnetMgr.getConfigurationApi().getMailProperties(); smtpServerName = mailProperties.getSmtpServer(); int port = mailProperties.getSmtpPort(); if (port < 0) { port = UIConstants.DEFAULT_SMTP_PORT; } smtpPortNumber = new Integer(port).toString(); fromAddress = mailProperties.getFromAddr(); isEmailNotificationsEnabled = mailProperties.getEmailNotificationsEnabled(); }
/* * (non-Javadoc) * * @see com.intel.stl.ui.email.IEmailControl#onOK() */ @Override public void onOK() { // Should retrieve the values presently set in the view and // save them in the controller (here). smtpServerName = view.getSmtpServerNameStr(); smtpPortNumber = view.getSmtpServerPortStr(); fromAddress = view.getFromAddrStr(); isEmailNotificationsEnabled = view.getEnableEmail(); // Save to the database. MailProperties mailProperties = new MailProperties(); mailProperties.setSmtpServer(smtpServerName); mailProperties.setFromAddr(fromAddress); mailProperties.setSmtpPort(new Integer(smtpPortNumber)); mailProperties.setEmailNotificationsEnabled(isEmailNotificationsEnabled); subnetMgr.getConfigurationApi().updateMailProperties(mailProperties); }
/* * (non-Javadoc) * * @see com.intel.stl.ui.email.IEmailControl#onTest() */ @Override public void onTest() { // Should retrieve the values presently set in the view and use // these values to send the test email String testSmtpHostName = view.getSmtpServerNameStr(); String testSmtpPortNum = view.getSmtpServerPortStr(); String testToAddr = view.getToAddrStr(); String testFromAddr = view.getFromAddrStr(); // Test connection with above values... MailProperties mailProperties = new MailProperties(); mailProperties.setSmtpServer(testSmtpHostName); mailProperties.setFromAddr(testFromAddr); mailProperties.setSmtpPort(new Integer(testSmtpPortNum)); String subject = UILabels.STL92001_TEST_EMAIL_SUBJECT.getDescription(); String body = ""; subnetMgr.getConfigurationApi().sendTestMail(mailProperties, testToAddr, subject, body); }