Simplified email placeholders

master
M66B 2 weeks ago
parent fdeced1c4f
commit c5b35d93fb

@ -865,16 +865,12 @@ public class MessageHelper {
static String replacePlaceholders(String address, EntityMessage message, EntityIdentity identity) throws UnsupportedEncodingException { static String replacePlaceholders(String address, EntityMessage message, EntityIdentity identity) throws UnsupportedEncodingException {
if (hasPlaceholder(address)) { if (hasPlaceholder(address)) {
Address from = getFrom(message, identity); if (message.from != null &&
if (from instanceof InternetAddress) { message.from.length == 1 &&
String email = ((InternetAddress) from).getAddress(); message.from[0] instanceof InternetAddress) {
String email = ((InternetAddress) message.from[0]).getAddress();
String user = UriHelper.getEmailUser(email); String user = UriHelper.getEmailUser(email);
String domain = UriHelper.getEmailDomain(email); String domain = UriHelper.getEmailDomain(email);
if (message.extra != null) {
Pair<String, String> extra = getExtra(email, message.extra);
if (extra.second != null)
email = extra.second;
}
address = address address = address
.replace("$from$", email) .replace("$from$", email)
.replace("$user$", user) .replace("$user$", user)

Loading…
Cancel
Save