Details
Description
Before 2.2, Mirth allowed the use of variables in the Email Sender From field. As of 2.2, it seems as if the message dispatcher no longer replaces any Velocity templates for the From field. I can see that in 2.1.1, the SmtpMessageDispatcher uses a MessageObjectToEmailMessage to transform the MessageObject and replace the Velocity variables. In 2.2, the dispatcher instead uses an Apache Email object, and does the replacement right there in the doDispatch method. Here's the relevant code:
email.setFrom(connector.getFrom());
email.setSubject(replacer.replaceValues(connector.getSubject(), mo));
The From address just comes directly from the SmtpConnector, while the Subject (and most of the other fields) goes through a TemplateValueReplacer first. I think the only change needed would be:
email.setFrom(replacer.replaceValues(connector.getFrom(), mo));
Is there a good reason why the From field shouldn't be allowed to accept Velocity templates? I had a few channels that were choosing the sender address dynamically (you may want some messages to come from "support@whatever.com" rather than "development@whatever.com", for example), so I was caught by surprise when my channel threw a bunch of errors after I upgraded from 2.1.1 to 2.2.1. In the meantime, I'm not using SMTP Senders at all; I'm just using JavaScript to send messages via SMTP manually.
Added variable value replacement in the SMTP Sender to the host, port, timeout, username, password, replyTo, headers, and from fields. Added the ability to send test emails to multiple addresses using a comma separated list.