You're right, I should've mentioned that in my first post.
Thanks so much, this solved the problem!
While inspecting the code, I came across an other problem: the while loop doesn't break out after the first match. This means that if per chance the exact header name (e.g. "Date: ") happens to reappear in the body of the e-mail text, the value of the real header will be overwritten by what follows the "fake" header in the text. To avoid that I replaced the following code (lignes 94-118):
function ScanEmailFile(path,filterFunc){
var ToEmail;
var FromEmail;
var fn = fs.OpenTextFile(path, 1, 2);
var results = {};
while (!fn.AtEndOfStream) {
var textLine = fn.ReadLine();
for(i=0;i<config.columns.length;i++) {
var match = config.columns[i].re.exec(textLine);
if (match != null)
{
if (match[1].substring(0,2) == "=?")
{
match[1] = st.Decode(match[1]);
}
results[config.columns[i].name] = match[1];
}
}
}
if (results){
return results;
} else return null;
}
with (including your fix):
function ScanEmailFile(path,filterFunc)
{
var result = {};
for(i=0;i<config.columns.length;i++)
{
var fn = fs.OpenTextFile(path, 1, 2);
while (!fn.AtEndOfStream)
{
var textLine = fn.ReadLine();
var match = config.columns[i].re.exec(textLine);
if (match != null)
{
fn.Close();
if (match[1].substring(0,2) == "=?")
{
match[1] = st.Decode(match[1]);
}
result[config.columns[i].name] = match[1];
break;
}
}
fn.Close();
}
if (result)
return result;
else
return null;
}
The two loops (for and while) had to be switched, otherwise the insertion of a break in the while loop would have terminated the for loop even if there were still columns left to be build.
Another point: Since renaming *.eml files to *.txt files allows DOpus to search inside the e-mail texts, I also added support for *.txt files by replacing line 76 with:
if (!scriptColData.item.is_dir && (scriptColData.item.ext.toLowerCase() == ".eml" || scriptColData.item.ext.toLowerCase() == ".msg" || scriptColData.item.ext.toLowerCase() == ".txt")) {
Maybe I should write a PM to the original author of the script (wowbagger), so that he can upload the corrected version to the script section.