StringTokenizer st = new StringTokenizer(parseVariables ? ScriptVariableParser.translateVariables(to, transientVars, ps).toString() : to, ", ");
VariableResolver variableResolver = config.getVariableResolver(); StringTokenizer st = new StringTokenizer(parseVariables ? variableResolver.translateVariables(to, transientVars, ps).toString() : to, ", ");
    public void execute(Map transientVars, Map args, PropertySet ps) {        String to = (String) args.get("to");        String from = (String) args.get("from");        String subject = (String) args.get("subject");        String cc = (String) args.get("cc");        String m = (String) args.get("message");        String smtpHost = (String) args.get("smtpHost");        boolean parseVariables = "true".equals(args.get("parseVariables"));        try {            Properties props = new Properties();            props.put("mail.smtp.host", smtpHost);            Session sendMailSession = Session.getInstance(props, null);            Transport transport = sendMailSession.getTransport("smtp");            Message message = new MimeMessage(sendMailSession);            message.setFrom(new InternetAddress(from));            Set toSet = new HashSet();            StringTokenizer st = new StringTokenizer(parseVariables ? ScriptVariableParser.translateVariables(to, transientVars, ps).toString() : to, ", ");            while (st.hasMoreTokens()) {                String user = st.nextToken();                toSet.add(new InternetAddress(user));            }            message.setRecipients(Message.RecipientType.TO, (InternetAddress[]) toSet.toArray(new InternetAddress[toSet.size()]));            Set ccSet = null;            if (cc != null) {                ccSet = new HashSet();                if (parseVariables) {                    cc = ScriptVariableParser.translateVariables(cc, transientVars, ps).toString();                }                st = new StringTokenizer(cc, ", ");                while (st.hasMoreTokens()) {                    String user = st.nextToken();                    ccSet.add(new InternetAddress(user));                }            }            if ((ccSet != null) && (ccSet.size() > 0)) {                message.setRecipients(Message.RecipientType.CC, (InternetAddress[]) ccSet.toArray(new InternetAddress[ccSet.size()]));            }            message.setSubject(parseVariables ? ScriptVariableParser.translateVariables(subject, transientVars, ps).toString() : subject);            message.setSentDate(new Date());            message.setText(parseVariables ? ScriptVariableParser.translateVariables(m, transientVars, ps).toString() : m);            message.saveChanges();            transport.connect();            transport.sendMessage(message, message.getAllRecipients());            transport.close();        } catch (MessagingException e) {            log.error("Error sending email:", e);        }    }