Setting to change default naming convention for saved emails
-
- Posts: 6
- Joined: February 16th, 2016, 9:54 am
Setting to change default naming convention for saved emails
Steps to reproduce:
Saved email to a directory, (either by drag and drop or File> Save).
Actual results:
The email file name was the subject of the email by default.
Expected results:
It would be useful if Thunderbird had a setting to change the default naming convention for saving, (similar to the custom page header in Firefox for printing).
For example, the user could set "YYYY-MM-DD 24hrTime, Sender, Subject" to be the default file name format for saving emails. It may be enough if this option were made available in about:config.
In my own workflow, after completing a customer project, I like to save all related email correspondence to a customer folder which also contains website designs, logo designs, work orders, etc. This way if I need to revisit, back up, or delete a particular project, everything's in one place.
This is preferable to archiving the related emails separately in Thunderbird, which results in a bloated email directory and difficult project management. Thunderbird facilitates this by allowing simple drag and drop to save emails to a folder.
However, having to rename each email file (of which there are many in a large project) is too much work, when I simply need to prefix the file name with date and time received so that it is listed in sequence.
As an aside, it might be nice if the custom file name setting applied to the new Maildir storage format as well.
I have posted this at bugzilla.mozilla.org too:
https://bugzilla.mozilla.org/show_bug.cgi?id=1248184
----------------------------------------------------------------------
Related Notes:
I am aware that you can already sort saved emails files by listing their metadata. For example, In Windows 7 adding the "Date," "Authors" and "Name" fields in the file manager allows you to view and sort by date sent/ received, sender/ recipient, and subject. Others may find this a workable alternative. However, I find that OS's generally have clunky meta data management, and that a simple file name solution would provide better all-around support.
Furthermore, I store other kinds of records and correspondences along with the email files, and these do not all have the same metadata, so this solution does not work for me.
Looking through the forums, I see that many others save email outside of Thunderbird as well, and in the past have asked about saving multiple emails at the same time. The present version of Thunderbird supports this, but only by using the subject as the file name.
----------------------------------------------------------------------
Related Posts:
[Mac] Saving files using 'Save As' (.eml)
http://forums.mozillazine.org/viewtopic ... 9&t=457898
Save email to folder on desktop. Unique Re: files needed.
http://forums.mozillazine.org/viewtopic ... &t=2362853
saving emails to a folder on external drive
http://forums.mozillazine.org/viewtopic ... &sk=t&sd=a
Saving Multiple Email Files
http://forums.mozillazine.org/viewtopic ... &t=1686255
Save multiple emails in a chosen format no longer possible
http://forums.mozillazine.org/viewtopic ... &t=2114069
Automating saving out .eml files?
http://forums.mozillazine.org/viewtopic.php?t=113120
How to save e-mail keeping original date/time information?
http://forums.mozillazine.org/viewtopic ... &t=1980797
saving multiple emails
http://forums.mozillazine.org/viewtopic ... 9&t=809785
Saved email to a directory, (either by drag and drop or File> Save).
Actual results:
The email file name was the subject of the email by default.
Expected results:
It would be useful if Thunderbird had a setting to change the default naming convention for saving, (similar to the custom page header in Firefox for printing).
For example, the user could set "YYYY-MM-DD 24hrTime, Sender, Subject" to be the default file name format for saving emails. It may be enough if this option were made available in about:config.
In my own workflow, after completing a customer project, I like to save all related email correspondence to a customer folder which also contains website designs, logo designs, work orders, etc. This way if I need to revisit, back up, or delete a particular project, everything's in one place.
This is preferable to archiving the related emails separately in Thunderbird, which results in a bloated email directory and difficult project management. Thunderbird facilitates this by allowing simple drag and drop to save emails to a folder.
However, having to rename each email file (of which there are many in a large project) is too much work, when I simply need to prefix the file name with date and time received so that it is listed in sequence.
As an aside, it might be nice if the custom file name setting applied to the new Maildir storage format as well.
I have posted this at bugzilla.mozilla.org too:
https://bugzilla.mozilla.org/show_bug.cgi?id=1248184
----------------------------------------------------------------------
Related Notes:
I am aware that you can already sort saved emails files by listing their metadata. For example, In Windows 7 adding the "Date," "Authors" and "Name" fields in the file manager allows you to view and sort by date sent/ received, sender/ recipient, and subject. Others may find this a workable alternative. However, I find that OS's generally have clunky meta data management, and that a simple file name solution would provide better all-around support.
Furthermore, I store other kinds of records and correspondences along with the email files, and these do not all have the same metadata, so this solution does not work for me.
Looking through the forums, I see that many others save email outside of Thunderbird as well, and in the past have asked about saving multiple emails at the same time. The present version of Thunderbird supports this, but only by using the subject as the file name.
----------------------------------------------------------------------
Related Posts:
[Mac] Saving files using 'Save As' (.eml)
http://forums.mozillazine.org/viewtopic ... 9&t=457898
Save email to folder on desktop. Unique Re: files needed.
http://forums.mozillazine.org/viewtopic ... &t=2362853
saving emails to a folder on external drive
http://forums.mozillazine.org/viewtopic ... &sk=t&sd=a
Saving Multiple Email Files
http://forums.mozillazine.org/viewtopic ... &t=1686255
Save multiple emails in a chosen format no longer possible
http://forums.mozillazine.org/viewtopic ... &t=2114069
Automating saving out .eml files?
http://forums.mozillazine.org/viewtopic.php?t=113120
How to save e-mail keeping original date/time information?
http://forums.mozillazine.org/viewtopic ... &t=1980797
saving multiple emails
http://forums.mozillazine.org/viewtopic ... 9&t=809785
- DanRaisch
- Moderator
- Posts: 127246
- Joined: September 23rd, 2004, 8:57 pm
- Location: Somewhere on the right coast
Re: Setting to change default naming convention for saved em
Just so you're clear on things, we're not Mozilla, so we can't change the way Thunderbird works. This forum is not run by or formally associated with Mozilla. We're an independent user-helping-user community.
-
- Posts: 6
- Joined: February 16th, 2016, 9:54 am
Re: Setting to change default naming convention for saved em
Yes. I posted here as well since there's no guarantee Mozilla will pick this up. This is a feature I'd really like.
Thunderbird code is already reading the "subject" variable to name email files. Perhaps a simple add-on could affix the "date" variable to this. The add-on wouldn't even need a user interface- if further customization is necessary it could keep a setting in about:config.
This might be a good, first-time add-on to develop myself, if I ever got around to it. I'm primarily into graphic and web design right now.
Would many other people want a feature like this?
Thunderbird code is already reading the "subject" variable to name email files. Perhaps a simple add-on could affix the "date" variable to this. The add-on wouldn't even need a user interface- if further customization is necessary it could keep a setting in about:config.
This might be a good, first-time add-on to develop myself, if I ever got around to it. I'm primarily into graphic and web design right now.
Would many other people want a feature like this?
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: Setting to change default naming convention for saved em
You can rewrite the validateFileName function with the userChromeJS extension.
userChromeJS allows complete chrome customization when an extension is excessive.
http://userchromejs.mozdev.org/
http://userchromejs.mozdev.org/faq.html
Why doesn't a script change take effect on restart?
Gecko has a javascript cache, which is not automatically cleared across restarts. To clear the cache when restarting, add a -purgecaches flag to the executable commandline.
i.e.
thunderbird.exe -purgecaches
ThunderbirdPortable.exe -purgecaches
userChromeJS is now signed
http://forums.mozillazine.org/viewtopic ... #p14265089
userChromeJS allows complete chrome customization when an extension is excessive.
Code: Select all
/* Thunderbird 38 userChrome.js */
(function() {
if (location == "chrome://messenger/content/messenger.xul") {
window.originalValidateFileName = window.validateFileName;
window.validateFileName = function (aFileName) {
var selectedMessages = window.gFolderDisplay.selectedMessages;
if (selectedMessages.length == 1) {
var d = selectedMessages[0].date / 1000;
d = new Date(d);
var year = d.getFullYear();
var month = d.getMonth() + 1;
var day = d.getDate();
var hour = d.getHours();
var minute = d.getMinutes();
var second = d.getSeconds();
if (month.toString().length == 1) month = "0" + month;
if (day.toString().length == 1) day = "0" + day;
if (hour.toString().length == 1) hour = "0" + hour;
if (minute.toString().length == 1) minute = "0" + minute;
if (second.toString().length == 1) second = "0" + second;
var date = year + "-" + month + "-" + day;
var time = hour + "" + minute + "" + second;
date = window.originalValidateFileName(date);
time = window.originalValidateFileName(time);
var author = selectedMessages[0].mime2DecodedAuthor;
var subject = selectedMessages[0].mime2DecodedSubject;
author = window.originalValidateFileName(author);
subject = window.originalValidateFileName(aFileName);
var base = date + " " + time + " " + author + " " + subject;
return base;
} else {
return window.originalValidateFileName(aFileName);
}
}
}
})();
http://userchromejs.mozdev.org/faq.html
Why doesn't a script change take effect on restart?
Gecko has a javascript cache, which is not automatically cleared across restarts. To clear the cache when restarting, add a -purgecaches flag to the executable commandline.
i.e.
thunderbird.exe -purgecaches
ThunderbirdPortable.exe -purgecaches
userChromeJS is now signed
http://forums.mozillazine.org/viewtopic ... #p14265089
-
- Posts: 755
- Joined: April 1st, 2012, 10:21 am
Re: Setting to change default naming convention for saved em
You can define custom file names with ImportExportTools, e.g. Time, Date, Subject, Sender, Recipient, and add a custom prefix.
https://addons.mozilla.org/en-us/thunde ... porttools/
https://addons.mozilla.org/en-us/thunde ... porttools/
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: Setting to change default naming convention for saved em
D'oh. I forgot about the ImportExportTools extension. (hat tip to sfhowes)
-
- Posts: 6
- Joined: February 16th, 2016, 9:54 am
Re: Setting to change default naming convention for saved em
Thanks for the excellent tips everyone.
I didn't know about "experimental" addons, (they aren't listed in Thunderbird's standard Addon Manager) or about the userChrome.js file.
ImportExportTools almost works for me, but the date and time format isn't customizable. It only lists the date as a string of numbers without dash separators. This makes it difficult to mix in other file types under the same directory, where each file needs to conform to the same date format prefix. I looked up the settings for this addon in about:config, but they provided no further customization than the user interface.
I found another addon, "AutoSave," which might do what I need, but it's not available for the latest versions of Thunderbird.
As for the userChrome.js file- I don't currently program in Javascript, but I wonder if the example morat provided could be even simpler. Thunderbird displays email date and time in the format specified by the OS, (my Windows system is set to YYYY-MM-DD). Is there a Thunderbird variable we could just pull this from and forgo all the date and time re-parsing?
Not that I'm in a hurry now. I'm betting that Thunderbird or some plugin will be updated like I want before I ever get around to it myself, and in the meantime I might make do with ImportExportTools
One final point of interest- Thunderbird fails silently when saving multiple emails with the same subject, (which is a very common thing). A file name date and time prefix would solve this issue as well.
I didn't know about "experimental" addons, (they aren't listed in Thunderbird's standard Addon Manager) or about the userChrome.js file.
ImportExportTools almost works for me, but the date and time format isn't customizable. It only lists the date as a string of numbers without dash separators. This makes it difficult to mix in other file types under the same directory, where each file needs to conform to the same date format prefix. I looked up the settings for this addon in about:config, but they provided no further customization than the user interface.
I found another addon, "AutoSave," which might do what I need, but it's not available for the latest versions of Thunderbird.
As for the userChrome.js file- I don't currently program in Javascript, but I wonder if the example morat provided could be even simpler. Thunderbird displays email date and time in the format specified by the OS, (my Windows system is set to YYYY-MM-DD). Is there a Thunderbird variable we could just pull this from and forgo all the date and time re-parsing?
Not that I'm in a hurry now. I'm betting that Thunderbird or some plugin will be updated like I want before I ever get around to it myself, and in the meantime I might make do with ImportExportTools
One final point of interest- Thunderbird fails silently when saving multiple emails with the same subject, (which is a very common thing). A file name date and time prefix would solve this issue as well.
- tanstaafl
- Moderator
- Posts: 49647
- Joined: July 30th, 2003, 5:06 pm
Re: Setting to change default naming convention for saved em
The add-on manager is buggy and will not list all Thunderbird add-ons on the Mozilla add-ons web site in its search results. The simplest way to workaround that is to select "get add-on" on the left, and then click on "see all" (on the right, next to "Up and Coming"). Then you can search for an add-on using the Mozilla add-ons web page, within Thunderbird.
It also doesn't know about https://freeshell.de/~kaosmos/index-en.html , the personal web site of Paolo Kaosmos. He's written many add-ons, and actively maintains them. Some of the most popular (such as ImportExportTools) are also on the Mozilla add-ons web site, but most aren't.
You might be able to get Frank DiLecce's "Tb AutoSave Extension" to work if you install the disable add-on compatibility checks add-on beforehand, and ignore the error message about AutoSave not being supported, but I don't recommend it. The rule of thumb I use is not to try that with anything that doesn't support at least version 3.0. See http://forums.mozillazine.org/viewtopic ... 8&t=280532 for details about its options.
It also doesn't know about https://freeshell.de/~kaosmos/index-en.html , the personal web site of Paolo Kaosmos. He's written many add-ons, and actively maintains them. Some of the most popular (such as ImportExportTools) are also on the Mozilla add-ons web site, but most aren't.
You might be able to get Frank DiLecce's "Tb AutoSave Extension" to work if you install the disable add-on compatibility checks add-on beforehand, and ignore the error message about AutoSave not being supported, but I don't recommend it. The rule of thumb I use is not to try that with anything that doesn't support at least version 3.0. See http://forums.mozillazine.org/viewtopic ... 8&t=280532 for details about its options.
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: Setting to change default naming convention for saved em
You could edit the dateInSecondsTo8601 function in the utils.js file in the ImportExportTools archive to add the dash separators.browser.tech wrote:date as a string of numbers without dash separators
Find:
Code: Select all
var msgDate8601string = msgDate8601.toString()+month.toString()+day.toString();
Code: Select all
var msgDate8601string = msgDate8601.toString() + "-" + month.toString() + "-" + day.toString();
unzip chrome\mboximport.jar content\mboximport\utils.js
wordpad content\mboximport\utils.js
zip chrome\mboximport.jar content\mboximport\utils.js
zip importexporttools.xpi chrome\mboximport.jar
-
- Posts: 6
- Joined: February 16th, 2016, 9:54 am
Re: Setting to change default naming convention for saved em
@tanstaafl
Yup. Found that. It's nice to be able to search *all* the addons for Thunderbird. I'd been looking at Kaosmos' website too, (it's kind of tough that XUL is being depreciated).
Thanks for the tip about the disable add-on compatibility checks.
@morat
Nice! I didn't realize these addons were just zipped files. I've modified my Windows registry to handle them.
I made a few changes to the utils.js file and added the following variables:
var SafeFilenameCharSubstitute = "";
var ReColonCharSubstitute = " ";
var FilenameFieldSeparator = ", ";
var SeparatorForDate = "-";
var SeparatorForTime = ";";
(I can send the whole file if anyone's interested.)
Now my saved emails look like:
2016-02-11 13;36-Sender Name-Re Subject.eml
...Much closer to what I wanted, although the FilenameFieldSeparator isn't working.
I would have preferred:
2016-02-11 13;36, Real Email Address, Re Subject.eml
It'd also be a lot easier to use drag and drop instead of File> Save> Select Directory.
This will do for now though. I should get back to other work.
Yup. Found that. It's nice to be able to search *all* the addons for Thunderbird. I'd been looking at Kaosmos' website too, (it's kind of tough that XUL is being depreciated).
Thanks for the tip about the disable add-on compatibility checks.
@morat
Nice! I didn't realize these addons were just zipped files. I've modified my Windows registry to handle them.
I made a few changes to the utils.js file and added the following variables:
var SafeFilenameCharSubstitute = "";
var ReColonCharSubstitute = " ";
var FilenameFieldSeparator = ", ";
var SeparatorForDate = "-";
var SeparatorForTime = ";";
(I can send the whole file if anyone's interested.)
Now my saved emails look like:
2016-02-11 13;36-Sender Name-Re Subject.eml
...Much closer to what I wanted, although the FilenameFieldSeparator isn't working.
I would have preferred:
2016-02-11 13;36, Real Email Address, Re Subject.eml
It'd also be a lot easier to use drag and drop instead of File> Save> Select Directory.
This will do for now though. I should get back to other work.
-
- Posts: 6
- Joined: February 16th, 2016, 9:54 am
Re: Setting to change default naming convention for saved em
One more thing- I noticed that ImportExportTools appends an incremental number to filename duplicates to avoid losing messages, (Thunderbird doesn't do this on it's own).
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: Setting to change default naming convention for saved em
Here is how I would change the dash separators to comma separators.
* utils.js
* utils.js
Code: Select all
var pattern = IETprefs.getCharPref("extensions.importexporttools.export.filename_pattern");
+ pattern = pattern.replace(/-/g, ",");
Code: Select all
- pattern = pattern.replace(/-%e/g, "");
+ pattern = pattern.replace(/,%e/g, "");
Code: Select all
- fname = fname.replace(/[\/\\:,<>*\?\"\|\']/g,"_");
+ fname = fname.replace(/[\/\\:<>*\?\"\|\']/g,"_");
-
- Posts: 13
- Joined: May 19th, 2009, 9:38 am
Re: Setting to change default naming convention for saved em
ImportExportTools doesn't seem to work when printing to PDF. Thunderbird used to default to email subject but now fails 50% of time with "about/blank.pdf" filename. I then have to go back and manually copy the subject from the email and paste into save dialog.
-
- Posts: 755
- Joined: April 1st, 2012, 10:21 am
Re: Setting to change default naming convention for saved em
That may be an OSX-related bug, as here in W10 the exported pdf name is always the message Subject.blackbox98 wrote:ImportExportTools doesn't seem to work when printing to PDF. Thunderbird used to default to email subject but now fails 50% of time with "about/blank.pdf" filename. I then have to go back and manually copy the subject from the email and paste into save dialog.
-
- New Member
- Posts: 1
- Joined: March 10th, 2017, 11:58 am
Re: Setting to change default naming convention for saved em
I would like to have the whole file! Sorry for posting it here, I just registered and can't use private messages yet.browser.tech wrote:
@morat
Nice! I didn't realize these addons were just zipped files. I've modified my Windows registry to handle them.
I made a few changes to the utils.js file and added the following variables:
var SafeFilenameCharSubstitute = "";
var ReColonCharSubstitute = " ";
var FilenameFieldSeparator = ", ";
var SeparatorForDate = "-";
var SeparatorForTime = ";";
(I can send the whole file if anyone's interested.)
Now my saved emails look like:
2016-02-11 13;36-Sender Name-Re Subject.eml