Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Change subject of received emails in Mail.app Apps
Obsessive filers, or those who use Mail.app as more than an email client (I use it to store recipes and snippets because it so easy to search), may wish to change the Subject line on received messages. However, Mail won't let you do this.

To work around this, drag the the inappropriately titled, wrongly spelled, or incriminatingly subjected message out of the Inbox into Drafts. Then double-click to edit the message, change the Subject line, and click Save. Drag the message back to Inbox, and you're done.

Note that the received date and time will change when you do this.
    •    
  • Currently 2.08 / 5
  You rated: 2 / 5 (12 votes cast)
 
[31,024 views]  

Change subject of received emails in Mail.app | 15 comments | Create New Account
Click here to return to the 'Change subject of received emails in Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change subject of received emails in Mail.app
Authored by: leenoble_uk on Apr 04, '06 08:15:46AM

This Applescript will allow you to change the subject of a single message or merge messages under the same subject heading. A few caveats though:

  1. It will only work on messages in the inbox, if you want to merge messages in a different mailbox then you will have to adjust the script.
  2. By all accounts THIS SHOULDN'T WORK. When writing this script a couple of years ago I could not find a workable solution and was told it was impossible to alter an incoming message, yet this has worked for me for some time. I'm not sure exactly what it's doing since if you use it multiple times you will notice that Mail still remembers the old subjects.
  3. I do not know if this works in 10.4 mail. I'm still on 10.3 so use it at your own risk.

Save as a scpt file in ~/Library/Scripts/Mail Scripts and run it from the script menu in Mail. If you only have one message selected you can enter a new subject, or if you select multiple messages you will have a choice of selecting an existing subject or writing a new one.


(*
MERGE THREADS by Lee Noble
--------------------------
It's frustrating when you have different contributors to an
email conversation start using different subject titles and Mail
doesn't keep up. Mail seems only to ignore Re: or Fw: in its
efforts to determine which messages are in the same thread.
So in an attempt to get several scattered subjects to appear as a
single coherent thread it is necessary to make all messages carry
the same subject line. This isn't possible through the Mail
interface. It is possible using AppleScript

*)


tell application "Mail"
	set theSubjectList to {}
	set headList to {}
	set themessages to selection as list
	set messageTitle to button returned of (display dialog "Thread name…" buttons {"New", "Select From Existing…"} default button 2)
	repeat with msg in themessages
		set theHeaders to headers of msg as list
		set thisSubject to (subject of msg as string)
		repeat with head in theHeaders
			if (name of head as string is "Thread-Topic") and (content of head as string is not in theSubjectList) then
				set theSubjectList to theSubjectList & {(content of head as string)}
			else if thisSubject is not in theSubjectList then
				set theSubjectList to theSubjectList & {thisSubject}
			end if
		end repeat
		if thisSubject is not in theSubjectList then
			set theSubjectList to theSubjectList & {thisSubject}
		end if
	end repeat
	
	if messageTitle is "New" then
		set theNewSubject to (text returned of (display dialog "Type new subject" default answer "NEW THREAD")) as string
	else
		set theNewSubject to (choose from list theSubjectList with prompt "Choose the subject of the merged thread…") as string
	end if
	
	if theNewSubject is not "false" then
		repeat with msg in themessages
			set subject of msg to (theNewSubject)
		end repeat
		move msg to mailbox "INBOX" of account of mailbox of msg
	else
		display dialog "Action cancelled"
	end if
end tell

---
Brought to you by S C Johnson, a family multinational conglomerate.

[ Reply to This | # ]

Change subject of received emails in Mail.app
Authored by: Satinder S Sidhu on Apr 04, '06 08:43:45AM

Received date and time are not the only things that change; the "From:" also changes to you (the changer).

This would be a problem if you later search for the message by Sender beacuse you happen to remember who the original was from.



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: leenoble_uk on Apr 04, '06 08:53:58AM

Oh I should mention, for those inclined to adjust/improve the script. It is not possible to get the script to dynamically retrieve the currently selected mailbox. This is why INBOX is hardcoded. You really do need separate scripts if you want to use it in any other mailbox.

It is the "move msg to mailbox "INBOX" of account of mailbox of msg" which forces the changes to stick although if you know anything about Applescript you'll be able to see that it should do absolutely nothing. Go figure.
To use in another box just change it to: "move msg to mailbox "Work/_To Do" where "Work/_To Do" is the path in mail to the mailbox you are in.

---
Brought to you by S C Johnson, a family multinational conglomerate.



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: hnhansen on Apr 04, '06 01:45:04PM
You said "It is not possible to get the script to dynamically retrieve the currently selected mailbox". Well, what about someting like this:

tell application "Mail"
	set theSelection to the selection
	return mailbox of item 1 of theSelection
end tell
This will return a reference to the mailbox of the selected message.

[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: leenoble_uk on Apr 04, '06 02:20:43PM

You're welcome to try it but I'm sure I tore my hair out for days trying to get it to work and I'm certain I tried that. I can't stress enough for people not to try, it'll just waste your time, trust me. I think it is a bug in Mail as far as I recall. If the script works in 10.4 then maybe the associated bug no longer exists so it may be worth the effort in that instance.

I tried numerous online resources and message boards and the only consistent reply I got was that it wasn't possible to modify an incoming message.

---
Brought to you by S C Johnson, a family multinational conglomerate.



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: richwiss on Apr 04, '06 06:43:21PM

I too pulled my hair out trying to fix this... but I just upgraded to 10.4.6 and I can now -- once again -- get the mailbox.

Good luck.



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: Mr_London on Apr 04, '06 02:26:12PM

doesnt work in 10.4.6... tried to change to new subject title but wont work :(



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: laurentbodard on Jun 21, '13 07:31:12AM

Hello there - I am most keen to have a script that works with Apple Mail.

Could you indicate whether you have a script for Apple Mail 6.5?

All the best,
Laurent



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: mingo on Apr 04, '06 05:36:03PM
 /usr/bin/mail
allows one to edit mbox style messages. One types
 mail -f <filename>
Once mail opens the file then one types

& e n
where
n
is the number of the message. Edit, save and quit. Berkeley mail (or mailx) is the only program I know that will let you edit a message.

[ Reply to This | # ]
Just use MailTags
Authored by: strike3 on Apr 04, '06 06:44:08PM

http://www.indev.ca/MailTags.html

I just set the MailTags note (though you could use the keyword function also) to whatever the subject line should have been.

Then you need only search the "entire message" in Mail and your messages will show up, without altering the original mail. Since that's my default search setting in Mail, I need only type the subject line in the search box and Spotlight tracks down the message almost instantaneously.

I too have fought AppleScript for hours trying to modify the subject line of a message and initially I thought MailTags was just a less than perfect substitute -- but now I actually prefer MailTags because I know for sure my emails are exactly as they were sent (this is important for those of us who have forgetful people emailing us and then changing their tune later on -- it's nice to know for certain what they sent!)



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: syzygies on Apr 05, '06 07:59:54AM

Mail messages are text files; it is trivial to edit them directly, e.g. using a text editor such as BBEdit. I just tested changing the subject this way, and it worked fine.

This is crucial e.g. if one stumbles into the "duplicate message" bug in Mail: A missing message will derail a copy between mail folders, and the old copies already moved will not be deleted. Worse, Mail changes one of its tags to indicate the last folder (ironically, to help in deletes like it isn't doing here!), so standard duplicate finders won't remove the duplicate messages. One can use BBEdit to bulk replace this Apple XML field with a dummy home planet for all messages, then use a dupicate finder to remove duplicates.



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: jiclark on Apr 09, '06 05:18:14PM

Sounds interesting, but could you elaborate a bit for us? For example:

1) How do you find a particular message in your ~/Library/Mail directory?
2) Do you need to quit Mail before attempting any edits?
3) Are there potential 'gotchas' to be aware of when attempting to edit with a text editor?
4) Etc, etc.

Thanks,
John



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: laurentbodard on Nov 01, '12 02:08:28AM

Hello there - I am much interested in your finding for editing email subject in Mail.app.

I don't know BBEdit at all. Were you successful in using BBEdit?
Are you able to have a script to edit email subject that works well now?

All the best,
Laurent



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: kiltbear on Mar 30, '09 04:59:16PM

Nice. Simple & straightforward. Thanks!



[ Reply to This | # ]
Change subject of received emails in Mail.app
Authored by: laurentbodard on Nov 01, '12 01:13:13AM

Hello, hello - I am looking at a script just like the one described but for Mountain Lion and Mail 6.2.

Would you or someone in the community have something to share?

Laurent



[ Reply to This | # ]