From 3ee978484a893904d7eceb7990ec054eeb192311 Mon Sep 17 00:00:00 2001 From: David Edler Date: Tue, 12 Nov 2024 18:03:38 +0100 Subject: [PATCH 1/2] Add dmarc and spf indicators in mail view #1820 Signed-off-by: David Edler --- dev/View/User/MailBox/MessageView.js | 37 ++++++++++++++++++- .../templates/Views/User/MailMessageView.html | 2 + 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index db3cbd106..682695289 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -133,6 +133,8 @@ export class MailMessageView extends AbstractViewRight { // viewer viewFromShort: '', dkimData: ['none', '', ''], + spfData: ['none', '', ''], + dmarcData: ['none', '', ''], nowTracking: false }); @@ -205,12 +207,43 @@ export class MailMessageView extends AbstractViewRight { } }, dkimIconClass: () => 'pass' === this.dkimData()[0] ? 'iconcolor-green' : 'iconcolor-red', - dkimTitle:() => { const dkim = this.dkimData(); return dkim[0] ? dkim[2] || 'DKIM: ' + dkim[0] : ''; }, + spfIcon: () => { + switch (this.spfData()[0]) { + case 'none': + return ''; + case 'pass': + return '✔'; + default: + return '✖'; + } + }, + spfIconClass: () => 'pass' === this.spfData()[0] ? 'iconcolor-green' : 'iconcolor-red', + spfTitle:() => { + const spf = this.spfData(); + return spf[0] ? spf[2] || 'SPF: ' + spf[0] : ''; + }, + + dmarcIcon: () => { + switch (this.dmarcData()[0]) { + case 'none': + return ''; + case 'pass': + return '✔'; + default: + return '✖'; + } + }, + dmarcIconClass: () => 'pass' === this.dmarcData()[0] ? 'iconcolor-green' : 'iconcolor-red', + dmarcTitle:() => { + const dmarc = this.dmarcData(); + return dmarc[0] ? dmarc[2] || 'DMARC: ' + dmarc[0] : ''; + }, + showWhitelistOptions: () => 'match' === SettingsUserStore.viewImages(), firstUnsubsribeLink: () => currentMessage()?.unsubsribeLinks()[0] || '', @@ -233,6 +266,8 @@ export class MailMessageView extends AbstractViewRight { // TODO: make first param a user setting #683 this.viewFromShort(message.from.toString(false, true)); this.dkimData(message.dkim[0] || ['none', '', '']); + this.spfData(message.spf[0] || ['none', '', '']); + this.dmarcData(message.dmarc[0] || ['none', '', '']); this.nowTracking(false); } else { MessagelistUserStore.selectedMessage(null); diff --git a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html index 41d9ccdd0..f3aa8517c 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/MailMessageView.html @@ -143,6 +143,8 @@
+ +
From 18da53564338aa8002bf89d325cd1304117a0ba2 Mon Sep 17 00:00:00 2001 From: David Edler Date: Mon, 18 Nov 2024 17:20:57 +0100 Subject: [PATCH 2/2] Show icon if no information is avilable on dkip, dmark or spf Signed-off-by: David Edler --- dev/View/User/MailBox/MessageView.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index 682695289..d093b6431 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -199,7 +199,7 @@ export class MailMessageView extends AbstractViewRight { dkimIcon: () => { switch (this.dkimData()[0]) { case 'none': - return ''; + return '🚫︎'; case 'pass': return '✔'; default: @@ -215,7 +215,7 @@ export class MailMessageView extends AbstractViewRight { spfIcon: () => { switch (this.spfData()[0]) { case 'none': - return ''; + return '🚫︎'; case 'pass': return '✔'; default: @@ -231,7 +231,7 @@ export class MailMessageView extends AbstractViewRight { dmarcIcon: () => { switch (this.dmarcData()[0]) { case 'none': - return ''; + return '🚫︎'; case 'pass': return '✔'; default: