Title: Re: Incorrect dates in emails
On 18/5/04 7:16 pm, "Timothy Myers" <[EMAIL PROTECTED]> wrote:

> The top message quoted below, from tuqqer, arrived this morning. It has the
> correct date except that it is off by two years. Other posts by tuqqer that I
> have saved have the correct dates.

Try this script:

-- Correct the date v1.0 25th June 2002
-- a script for Microsoft Entourage by Barry Wainwright
-- Resets the date of messages to the date of the first received header
-- useful for messages with badly formatted (or just plain wrong) dates

tell application "Microsoft Entourage"
    set theMessages to current messages
    if theMessages is {} then
        display dialog "No messages selected!" buttons {"Stop"} default button 1 with icon stop
        return -99
    end if
    
    repeat with theMess in theMessages
        set theHeaders to the headers of theMess
        set AppleScript's text item delimiters to {return & space}
        set theHeaders to text items of theHeaders
        set AppleScript's text item delimiters to {space}
        set theHeaders to theHeaders as string
        set AppleScript's text item delimiters to {return & tab}
        set theHeaders to text items of theHeaders
        set AppleScript's text item delimiters to {space}
        set theHeaders to theHeaders as string
        set theHeaders to the paragraphs of theHeaders
        set receivedHeader to ""
        repeat with aHeader in theHeaders
            if aHeader starts with "Received:" then copy contents of aHeader to receivedHeader
        end repeat
        set AppleScript's text item delimiters to {";"}
        set theDate to (last text item of receivedHeader)
        set time sent of theMess to date theDate
    end repeat
end tell

You can run the script on selected messages, or from a mail rule.

--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the Entourage FAQ pages? - Check them out:
  <http://www.entourage.mvps.org/toc.html>

Reply via email to