Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Microsoft managed to break their german translation of the mail programs, which results in subject lines like "AW: AW: AW: AW: AW: Question" when a mail is going back-and-forth and noone pays attention to the subject line. I believe the english version uses RE:, but strips it automatically.

I noticed OSX Mail.app is rather smart and removes multiple RE:, but it completely ignores the german version.

Is there a small setting/tool/plugin anywhere to make Mail.app recognize these too?

share|improve this question
    
And what does this have to do with Outlook? –  Dan Oct 24 '09 at 4:21
    
That the german version of Outlook is the one that has the (imho) broken translation and produces AW instead of RE. I want something for OS X Mail to work around that, since Microsoft clearly does not care about this and will probably never fix it. –  brandstaetter Oct 26 '09 at 6:45
add comment

1 Answer 1

up vote 1 down vote accepted
+100

The same in the Dutch Outlook: "Re: Betr.: Re: Doorgest.:" for "Re: Re: Re: Fw:" which should probably be just "Re:" then...

I am no AppleScript expert, but based on the samples in /Library/Scripts/Mail Scripts/Rule Actions, this might get you (or someone here at Super User) started. However, this is not at all a working solution, as I don't know how to make Mail persist the changes. The following will change the subject as shown in the message list, but not the same subject as shown above the message when viewing it. Even worse: restarting Mail gives one the old subject again.

I assume one needs to change the actual source of the message, not just the subject. And maybe AppleScript cannot even do that, but it felt like a waste of time not to post my tries here. ;-)

(EDIT: attempts to change the source property of a message yield "Mail got an error: AppleEvent handler failed." number -10000... Maybe the actual .emlx file must be changed on the file system?)

For testing, it's easiest to create a script that runs for the currently selected message. Like: save the following in a text file named, for example, test-clean-subject.scp and then double-click it to open AppleScript Editor. Then just click the Play button:

tell application "Mail"
  set selectedMessages to selection

  if (count of selectedMessages) is equal to 0 then
    display alert "No Messages Selected" message ¬
      "Select one or more messages before running this script."
  else
    repeat with theMessage in selectedMessages
      -- Of course, handling just one prefix is NOT AT ALL sufficient:
      set thePrefix to "Aw: "
      set theNewSubject to subject of theMessage
      repeat
        if theNewSubject does not start with thePrefix then
          exit repeat
        end if
        set theNewSubject to text ((length of thePrefix) + 1) ¬
          through -1 of theNewSubject
      end repeat

      -- Testing only:
      display dialog "New subject: " & theNewSubject

      -- This only (temporarily) sets the Subject in the message list.
      -- Maybe change "source" instead...?
      set subject of theMessage to theNewSubject

    end repeat
  end if
end tell

You might need to click on the message list to actually see Mail changed it. Again: the above does not solve your problem yet! Also, when one figures out how to persist the changed subject, then the search and removal/replace needs to be much more sophisticated than just searching for a single "Aw: ".

For a true Mail Rule, things need to be slightly different. Copy the relevant parts from a working standalone script into the following, save it and then create a new Rule in Mail for each incoming message (or for messages for a specific sender):

using terms from application "Mail"
  on perform mail action with messages theMessages for rule theRule
    tell application "Mail"
      repeat with theMessage in theMessages

        -- copy the actual script here...

      end repeat
    end tell
  end perform mail action with messages
end using terms from

See also Introduction to Scripting Mail at MacTech, and some examples of find and replace at MacScripter.

DISCLAIMER: none of the above has been tested a lot!

share|improve this answer
    
...even changing the .emlx file on the file system does not change the displayed subject right away. When closing and re-opening Mail's window it will change the Subject as shown above the message, but the Subject as shown in the message list is only changed when rebuilding the mailbox. Too bad, I guess a combination of Rules and AppleScript is not the way to do this -- unless things are different when a message is in the process of being received... –  Arjan Oct 27 '09 at 17:26
    
Ah, maybe after changing the .emlx file, all that's needed is (programmatically) move the message from one mailbox to another, and back. That's the easy part then! ;-) –  Arjan Oct 28 '09 at 7:49
    
Thanks for the input. If I have too much time on my hands (probably never) I'll take a closer look at that. Too bad that this annoyance will probably never be really fixed. –  brandstaetter Oct 29 '09 at 12:29
    
Amai, I should have asked not to give me that bounty... Now I might feel obliged to try some more ;-) (I actually might want to change the subject based on the headers some spam filters add, so I might come back...) –  Arjan Oct 29 '09 at 12:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.