/** Sends Emails to Customers who have not submitted their Bears */ public static void BearEmailSendMessage(String msgsubject, String msgText, String msgTo) { try { BearFrom = props.getProperty("BEARFROM"); // To = props.getProperty("TO"); SMTPHost = props.getProperty("SMTPHOST"); Properties mailprops = new Properties(); mailprops.put("mail.smtp.host", SMTPHost); // create some properties and get the default Session Session session = Session.getDefaultInstance(mailprops, null); // create a message Message msg = new MimeMessage(session); // set the from InternetAddress from = new InternetAddress(BearFrom); msg.setFrom(from); InternetAddress[] address = InternetAddress.parse(msgTo); msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject(msgsubject); msg.setContent(msgText, "text/plain"); Transport.send(msg); } // end try catch (MessagingException mex) { USFEnv.getLog().writeCrit("Message not sent", null, null); } catch (Exception ex) { USFEnv.getLog().writeCrit("Message not sent", null, null); } } // end BearEmailSendMessage
public void addMessage(Message msg) { String query = "INSERT INTO messages(text, author, timestamp, isDeleted) values(?, ?, ?, ?)"; try { PreparedStatement statement = connection.prepareStatement(query); statement.setString(1, msg.getText()); statement.setString(2, msg.getAuthor()); statement.setString(3, msg.getStingTimestamp()); statement.setInt(4, 0); statement.execute(); } catch (SQLException e) { e.printStackTrace(); } }
/** * Puts a message in the database Note: the timestamp will be stored as the current time at which * this method is called. */ public void storeMessage(Message message) { con.updateDB( "INSERT INTO " + MESSAGES + " VALUES ( \"" + message.getFrom() + "\", \"" + message.getTo() + "\", \"" + message.getBody() + "\", " + null + ", " + message.getType() + ")"); }
public void addRioxxVersionSection(List upload, Item item) throws WingException { String version = item.getMetadata("rioxxterms.version"); if (StringUtils.isNotBlank(version) && !"NA".equals(version)) { try { DCInputsReader a = new DCInputsReader(); java.util.List<String> pairs = a.getPairs("rioxxterms_version"); int humanReadable = pairs.indexOf(version) - 1; version = pairs.get(humanReadable); } catch (DCInputsReaderException e) { log.error(e.getMessage(), e); } upload .addItem("upload-rioxx-version-warning", "upload-rioxx-version-warning") .addContent(T_rioxx_version.parameterize(version)); } }