-
Notifications
You must be signed in to change notification settings - Fork 53
Script: CustomForwardHeader
SamuelPlentz edited this page Feb 7, 2020
·
2 revisions
This script creates a custom forward header using the information of the forwarded or replied mail. Especially the date can be reformatted, unneeded parts could be removed.
let originalSubject = this.mQuicktext.get_orgheader(["SUBJECT"])
let originalFrom = this.mQuicktext.get_orgheader(["FROM"])
let originalTo = this.mQuicktext.get_orgheader(["TO"])
let originalDate = new Date(Date.parse(this.mQuicktext.get_orgheader(["DATE"])));
// options described here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString
let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' };
return "----- Original message -----\n" +
"Subject: " + originalSubject + "\n" +
"Date: " + originalDate.toLocaleDateString(undefined, options) +"\n" + // undefined instead of "en-EN" or "de-DE" should use the users language by default
"From: " + originalFrom + "\n" +
"To: " + originalTo + "\n";
Using this script in your template:
[[SCRIPT=CustomForwardHeader]]
would resolve to:
----- Original message -----
Subject: Something funny
Date: Wednesday, February 5, 2020, 9:49 AM
From: "John Doe" <John.Doe@...>
To: "Jane Doe" <Jane.Doe@...>