Suggestion for Enhancement - Emails
#1 : 29/06-25 18:49 Nemo
Posts: 4
|
It would be useful if you could use metadata tags when renaming .eml and .msg files.
The email date/time, sender, each recipient, each CC would be useful. Sometimes there is only an email address - e.g. [email protected] Sometimes there is this form - John Smith <[email protected]> so that you have a name and an address. It would be useful to have separate tags for name and address as normally you just want to use name BUT if (and only if) there is no name then the name tag should contain the address. |
#2 : 04/07-25 19:22 Chris
Posts: 38
|
Reply to #1:
I too would like this! Meanwhile: https://www.advancedrenamer.com/forum_thread/how-to-use-spec ific-value-extracted-from-the-file-in-the-name-16003 |
#3 : 05/07-25 23:48 Delta Foxtrot
Posts: 521
|
Reply to #1:
Hi Nemo, I can't help with tags for the From information, but this little script seems to do what you are asking for. It finds the "From" line then checks if there's more than just an email address there; if there is it returns only the name portion. EDIT: If From field not found it returns the original filename. END EDIT Copy the text between the "// -----------------------" lines, open a blank script method and paste the text into it. Click on "Apply script", add your files, and see if it does what you want. Let me know. EDIT: You'll need to check what's in the "Settings / Renaming / Replace unsupported with:" field. I use nothing, or a space, and that's what this will work with. END EDIT (You didn't say how you wanted to see the output formatted, so I added the word "FROM" between the old filename and the new part. If you want something else just remove that word FROM and replace it with whatever legal characters you'd like. " - " would be another way to go, etc...) // ----------------------- for ( j = 1; app.parseTags( "<file line:"+j+">" ) != ""; j++ ) { line = app.parseTags( " <file line:"+j+">" ) ; if ( /^ *from/i.test( line ) ) { x = line.replace(/ *from */i, "" ) ; y = x.split( " " ) ; z = y.length ; if ( y[z-1].indexOf( "@" ) >= 0 && z > 1 ) { y.pop() ; } return item.newBasename + " FROM " + y.join( " " ) ; } } // ----------------------- Best, DF |
#4 : 06/07-25 18:56 Chris
Posts: 38
|
Reply to #3:
> for ( j = 1; app.parseTags( "<file line:"+j+">" ) != ""; j++ ) { > line = app.parseTags( " <file line:"+j+">" ) ; <file line:x> is undefined behavior so perhaps instead use <File Line:x>. |
#5 : 06/07-25 20:06 Delta Foxtrot
Posts: 521
|
Reply to #4:
Use whatever you want. The tags don't care. :) |
#6 : 06/07-25 20:18 Delta Foxtrot
Posts: 521
|
Reply to #5:
In fact, I think that's going to be my new tagline. The tags don't care, DF |
#7 : 07/07-25 10:51 Chris
Posts: 38
|
Reply to #6:
For "Date:" see https://www.advancedrenamer.com/forum_thread/script-to-prepe nd-eml-date-16051 |