1 package transactions.contactweb; 2 3 import dinamica.*; 4 5 14 public class SaveMessage extends GenericTableManager 15 { 16 17 20 public int service(Recordset inputParams) throws Throwable 21 { 22 super.service(inputParams); 24 25 String enabled = getConfig().getConfigValue("//mail/enabled"); 27 if (enabled.equals("true")) 28 { 29 30 String subject = inputParams.getString("category") + ": " + inputParams.getString("subject"); 32 String from = inputParams.getString("email_from"); 33 String fromName = inputParams.getString("name_from"); 34 35 String host = getConfig().getConfigValue("//mail/host"); 37 String to = getConfig().getConfigValue("//mail/to"); 38 39 String body = getResource("email.txt"); 41 TemplateEngine te = new TemplateEngine(getContext(),getRequest(), body); 42 te.replace(inputParams,""); 43 44 SimpleMail s = new SimpleMail(); 46 s.send(host, from, fromName, to, subject, te.toString()); 47 } 48 49 return 0; 50 } 51 52 } 53 | Popular Tags |