Expresion condition: added via

master
M66B 2 weeks ago
parent baaaf0d9b7
commit c08505817c

@ -32,7 +32,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
* Fixed all reported issues
* Added drag and drop to address bubbles
* Added *submitter*, *cc*, *bcc* and *replyto* to [expression conditions](https://m66b.github.io/FairEmail/#expression_conditions)
* Added *via*, *submitter*, *cc*, *bcc* and *replyto* to [expression conditions](https://m66b.github.io/FairEmail/#expression_conditions)
### 1.2333 2026-09-01

@ -3021,6 +3021,7 @@ Commonly used are && (=and) and || (=or).
The following extra variables are available:
* *received* (long, unix epoch in milliseconds; since version 1.2179)
* *via* (array of strings, [matched identity](#faq34); since version 1.2234)
* *submitter* (array of strings, sent on behalf of; since version 1.2234)
* *from* (array of strings)
* *to* (array of strings)

@ -32,7 +32,7 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
* Fixed all reported issues
* Added drag and drop to address bubbles
* Added *submitter*, *cc*, *bcc* and *replyto* to [expression conditions](https://m66b.github.io/FairEmail/#expression_conditions)
* Added *via*, *submitter*, *cc*, *bcc* and *replyto* to [expression conditions](https://m66b.github.io/FairEmail/#expression_conditions)
### 1.2333 2026-09-01

@ -63,7 +63,7 @@ import javax.mail.internet.InternetHeaders;
public class ExpressionHelper {
private static final List<String> EXPR_VARIABLES = Collections.unmodifiableList(Arrays.asList(
"received", "return_path", "submitter", "from", "to", "cc", "bcc", "subject", "replyto", "text", "hasAttachments"
"received", "return_path", "via", "submitter", "from", "to", "cc", "bcc", "subject", "replyto", "text", "hasAttachments"
));
static void check(Expression expression) throws ParseException {
@ -90,6 +90,16 @@ public class ExpressionHelper {
for (Address a : message.return_path)
return_path.add(MessageHelper.formatAddresses(new Address[]{a}));
List<String> via = new ArrayList<>();
if (message != null && message.identity != null) try {
DB db = DB.getInstance(context);
EntityIdentity identity = db.identity().getIdentity(message.id);
if (identity != null)
via.add(MessageHelper.formatAddresses(new Address[]{new InternetAddress(identity.email, identity.name)}));
} catch (Throwable ex) {
Log.e(ex);
}
List<String> submitter = new ArrayList<>();
if (message != null && message.submitter != null)
for (Address a : message.submitter)
@ -174,6 +184,7 @@ public class ExpressionHelper {
Expression expression = new Expression(eval, configuration)
.with("received", message == null ? null : message.received)
.with("return_path", return_path)
.with("via", via)
.with("submitter", submitter)
.with("from", from)
.with("to", to)

@ -1647,6 +1647,7 @@ X-Google-Original-From: Somebody &lt;somebody+extra@example.org&gt;</code></pre>
<p>The following extra variables are available:</p>
<ul>
<li><em>received</em> (long, unix epoch in milliseconds; since version 1.2179)</li>
<li><em>via</em> (array of strings, <a href="#faq34">matched identity</a>; since version 1.2234)</li>
<li><em>submitter</em> (array of strings, sent on behalf of; since version 1.2234)</li>
<li><em>from</em> (array of strings)</li>
<li><em>to</em> (array of strings)</li>

@ -32,7 +32,7 @@ Next version (Work in progress)
* Fixed all reported issues
* Added drag and drop to address bubbles
* Added *submitter*, *cc*, *bcc* and *replyto* to expression conditions
* Added *via*, *submitter*, *cc*, *bcc* and *replyto* to expression conditions
1.2333 2026-09-01

Loading…
Cancel
Save