mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 19:10:11 +01:00
Mark messages with failed DKIM, SPF or DMARC authentication
This commit is contained in:
@@ -90,6 +90,9 @@ public class EntityMessage implements Serializable {
|
||||
public String deliveredto;
|
||||
public String inreplyto;
|
||||
public String thread; // compose = null
|
||||
public Boolean dkim;
|
||||
public Boolean spf;
|
||||
public Boolean dmarc;
|
||||
public String avatar; // lookup URI from sender
|
||||
public String sender; // sort key
|
||||
public Address[] from;
|
||||
@@ -182,6 +185,31 @@ public class EntityMessage implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
static Boolean getAuthentication(String type, String header) {
|
||||
if (header == null)
|
||||
return null;
|
||||
|
||||
// https://tools.ietf.org/html/rfc7601
|
||||
Boolean result = null;
|
||||
String[] part = header.split(";");
|
||||
for (int i = 1; i < part.length; i++) {
|
||||
String[] kv = part[i].split("=");
|
||||
if (kv.length > 1) {
|
||||
String key = kv[0].trim();
|
||||
String[] val = kv[1].split(" ");
|
||||
if (val.length > 0 && type.equals(key)) {
|
||||
if ("fail".equals(val[0]))
|
||||
result = false;
|
||||
else if ("pass".equals(val[0]))
|
||||
if (result == null)
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean uiEquals(Object obj) {
|
||||
if (obj instanceof EntityMessage) {
|
||||
EntityMessage other = (EntityMessage) obj;
|
||||
|
||||
Reference in New Issue
Block a user