Title: Re: Date sent?
On 7/23/04 9:29 AM, I wrote:

          At this point, the script Barry posted recently becomes quite relevant. It adjusts the
          Received time field in Entourage to be that of the most recent Received header for the
          message, which would be your mail server, instead of the time you downloaded the message.
          One could set up a rule that runs on all incoming messages and runs this script, then
          allows subsequent rules (which can't be done in Entourage 2001 or X, I believe, only in
          2004).
          
          Barry's script:

I sent a version of the script which later was corrected by Paul Berkowitz with a fix, so here is the fixed version:

-- Script from a message sent by Barry Wainwright
-- on Wednesday, July 21, 2004 3:15:13 PM

-- Correct the date v1.0 25th June 2002
-- (Modified 22/7/2004 to set Time Received to First Received Header date)
-- 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
               exit repeat
           end if
       end repeat
       set AppleScript's text item delimiters to {";"}
        set thedate to (last text item of receivedHeader)
        set time received of theMess to date thedate
   end repeat
end
tell

Reply via email to