Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dmarc and spf indicators in mail view #1843

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions dev/View/User/MailBox/MessageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export class MailMessageView extends AbstractViewRight {
// viewer
viewFromShort: '',
dkimData: ['none', '', ''],
spfData: ['none', '', ''],
dmarcData: ['none', '', ''],
nowTracking: false
});

Expand Down Expand Up @@ -197,20 +199,51 @@ export class MailMessageView extends AbstractViewRight {
dkimIcon: () => {
switch (this.dkimData()[0]) {
case 'none':
return '';
return '🚫︎';
case 'pass':
return '✔';
default:
return '✖';
}
},
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] || '',
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@
<div class="informationShort">
<span class="from" data-bind="html: viewFromShort, attr:{ title: message().from }"></span>
<i class="fontastic" data-bind="text: dkimIcon, css: dkimIconClass, attr:{ title: dkimTitle }"></i>
<i class="fontastic" data-bind="text: dmarcIcon, css: dmarcIconClass, attr:{ title: dmarcTitle }"></i>
<i class="fontastic" data-bind="text: spfIcon, css: spfIconClass, attr:{ title: spfTitle }"></i>
</div>
</div>
<div id="messageItem">
Expand Down
Loading