I received a message on 13-Mar-05 from an Outlook user who may have had
his PC clock hosed. I view my Inbox by date from the most recent at the
top and the 28-Mar (future) message is always at the top

-----------
Date: Mon, 28 Mar 2005 10:39:53 -0500
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.2180
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
-----------

I tired to use the Mac Entourage 2004 Edit Message command but it will
not let me change the date. When I try to change the date it deletes
the message. I opened it as source file but then the Edit Message
option was not active.

Help...... Can the date on a hosed message be corrected?

aRKay

Re: How to Correct Date Stamp by Barry

Barry
Thu Mar 17 06:52:01 CST 2005

> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3193908723_10578321
Content-type: text/plain;
charset="US-ASCII"
Content-transfer-encoding: 7bit

On 16/3/05 12:42 am, in article
REMOVEarkay-4FE234.18423615032005@newssvr30-ext.news.prodigy.com, "aRKay"
<REMOVEarkay@qsl.net> wrote:

> I received a message on 13-Mar-05 from an Outlook user who may have had
> his PC clock hosed. I view my Inbox by date from the most recent at the
> top and the 28-Mar (future) message is always at the top
>
> -----------
> Date: Mon, 28 Mar 2005 10:39:53 -0500
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Mailer: Microsoft Outlook Express 6.00.2900.2180
> X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> X-RFC2646: Format=Flowed; Original
> -----------
>
> I tired to use the Mac Entourage 2004 Edit Message command but it will
> not let me change the date. When I try to change the date it deletes
> the message. I opened it as source file but then the Edit Message
> option was not active.
>
> Help...... Can the date on a hosed message be corrected?
>
> aRKay

Use my 'Correct the Date' script, which was written for just this task.
Copy/paste from below, but watch out for false line-wraps:



-- 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
--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the All-New Entourage Help Pages? - Check them out:
<http://www.entourage.mvps.org/>


--B_3193908723_10578321
Content-type: text/html;
charset="US-ASCII"
Content-transfer-encoding: quoted-printable

<HTML>
<HEAD>
<TITLE>Re: How to Correct Date Stamp</TITLE>
</HEAD>
<BODY>
<FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:12.0px'>On 16=
/3/05 12:42 am, in article REMOVEarkay-4FE234.18423615032005@newssvr30-ext.n=
ews.prodigy.com, &quot;aRKay&quot; &lt;REMOVEarkay@qsl.net&gt; wrote:<BR>
<BR>
<FONT COLOR=3D"#0000FF">&gt; I received a message on 13-Mar-05 from an Outloo=
k user who may have had <BR>
&gt; his PC clock hosed. &nbsp;I view my Inbox by date from the most recent=
at the &nbsp;<BR>
&gt; top and the 28-Mar (future) message is always at the top<BR>
&gt; <BR>
&gt; -----------<BR>
&gt; Date: Mon, 28 Mar 2005 10:39:53 -0500<BR>
&gt; X-Priority: 3<BR>
&gt; X-MSMail-Priority: Normal<BR>
&gt; X-Mailer: Microsoft Outlook Express 6.00.2900.2180<BR>
&gt; X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180<BR>
&gt; X-RFC2646: Format=3DFlowed; Original<BR>
&gt; -----------<BR>
&gt; <BR>
&gt; I tired to use the Mac Entourage 2004 Edit Message command but it will=
<BR>
&gt; not let me change the date. &nbsp;When I try to change the date it del=
etes <BR>
&gt; the message. &nbsp;I opened it as source file but then the Edit Messag=
e <BR>
&gt; option was not active.<BR>
&gt; <BR>
&gt; Help...... Can the date on a hosed message be corrected?<BR>
&gt; <BR>
&gt; aRKay<BR>
</FONT><BR>
Use my 'Correct the Date' script, which was written for just this task. Cop=
y/paste from below, but watch out for false line-wraps:<BR>
<BR>
<BR>
<BR>
-- Correct the date v1.0 25th June 2002<BR>
-- a script for Microsoft Entourage by Barry Wainwright<BR>
-- Resets the date of messages to the date of the first received header<BR>
-- useful for messages with badly formatted (or just plain wrong) dates<BR>
<BR>
tell application &quot;Microsoft Entourage&quot;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;set theMessages to current messages<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if theMessages is {} then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;display dialog &quot;No mes=
sages selected!&quot; buttons {&quot;Stop&quot;} default button 1 with icon =
stop<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return -99<BR>
&nbsp;&nbsp;&nbsp;&nbsp;end if<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;repeat with theMess in theMessages<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set theHeaders to the heade=
rs of theMess<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set AppleScript's text item=
delimiters to {return &amp; space}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set theHeaders to text item=
s of theHeaders<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set AppleScript's text item=
delimiters to {space}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set theHeaders to theHeader=
s as string<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set AppleScript's text item=
delimiters to {return &amp; tab}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set theHeaders to text item=
s of theHeaders<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set AppleScript's text item=
delimiters to {space}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set theHeaders to theHeader=
s as string<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set theHeaders to the parag=
raphs of theHeaders<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set receivedHeader to &quot=
;&quot;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeat with aHeader in theH=
eaders<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if =
aHeader starts with &quot;Received:&quot; then copy contents of aHeader to r=
eceivedHeader<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end repeat<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set AppleScript's text item=
delimiters to {&quot;;&quot;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set theDate to (last text i=
tem of receivedHeader)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set time sent of theMess to=
date theDate<BR>
&nbsp;&nbsp;&nbsp;&nbsp;end repeat<BR>
end tell<BR>
-- <BR>
Barry Wainwright<BR>
Microsoft MVP (see <a href=3D"http://mvp.support.microsoft.com">http://mvp.su=
pport.microsoft.com</a> for details)<BR>
Seen the All-New Entourage Help Pages? - Check them out:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;http://www.entourage.mv=
ps.org/&gt;<BR>
</SPAN></FONT>
</BODY>
</HTML>


--B_3193908723_10578321--


Re: How to Correct Date Stamp by Pitch

Pitch
Thu Mar 17 08:56:31 CST 2005

In case you have problems copying and pasting Barry's great script (I
always do, and don't know enough how to fix them), it can be found
here:

http://www.scriptbuilders.net/category.php?search=Correct+the+Date

I love this script. Thanks, Barry.


Re: How to Correct Date Stamp by aRKay

aRKay
Thu Mar 17 21:42:02 CST 2005

In article <1111071391.425270.71030@o13g2000cwo.googlegroups.com>,
"Pitch" <pitchblackcoffee@gmail.com> wrote:

> In case you have problems copying and pasting Barry's great script (I
> always do, and don't know enough how to fix them), it can be found
> here:
>
> http://www.scriptbuilders.net/category.php?search=Correct+the+Date
>
> I love this script. Thanks, Barry.

Fantistic, it worked great. The bad message now had the correct date!

Re: How to Correct Date Stamp by aRKay

aRKay
Thu Mar 17 21:43:07 CST 2005

In article <BE5F2DF1.46B91%barry@mvps.org.INVALID>,
Barry Wainwright <barry@mvps.org.INVALID> wrote:

> On 16/3/05 12:42 am, in article
> REMOVEarkay-4FE234.18423615032005@newssvr30-ext.news.prodigy.com, "aRKay"
> <REMOVEarkay@qsl.net> wrote:
>
> > I received a message on 13-Mar-05 from an Outlook user who may have had
> > his PC clock hosed. I view my Inbox by date from the most recent at the
> > top and the 28-Mar (future) message is always at the top
> >
> > -----------
> > Date: Mon, 28 Mar 2005 10:39:53 -0500
> > X-Priority: 3
> > X-MSMail-Priority: Normal
> > X-Mailer: Microsoft Outlook Express 6.00.2900.2180
> > X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
> > X-RFC2646: Format=Flowed; Original
> > -----------
> >
> > I tired to use the Mac Entourage 2004 Edit Message command but it will
> > not let me change the date. When I try to change the date it deletes
> > the message. I opened it as source file but then the Edit Message
> > option was not active.
> >
> > Help...... Can the date on a hosed message be corrected?
> >
> > aRKay
>
> Use my 'Correct the Date' script, which was written for just this task.
> Copy/paste from below, but watch out for false line-wraps:
>
>
>
> -- 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

Thanks! it worked PERFECT. Really a nice script.

dick

Re: How to Correct Date Stamp by gg

gg
Thu Apr 07 17:44:21 CDT 2005

The script corrects most of my munged mail... but there are some
problems:

The first - the time picked up is that in the last received header,
which is generally the time that the mail hit the first MTA. This is
great if the broken part of the date is the sent time, but in my case
the sent time was fine - the received time was b0rked. When Entourage
crashes with the imap server connected (dovecot 0.99.11), it begins
re-receiving all of the email but uses the current time as the received
time. Oddly enough, this became evident after a number of crashes of
the script on a large group of emails. Examination of the event log led
to the identification of an apparent flaw in the script:

The header of a typical email that caused a crash, munged for privacy:

Received: from pu.ogauud.com (ns.ogauud.com [x.x.x.x])
by ogud.com (8.12.11/8.12.11) with ESMTP id j2AGv5qW008089;
Thu, 10 Mar 2005 11:57:05 -0500 (EST)
(envelope-from ogauud@ogauud.com)

resulting in:

"Invalid date and time Thu, 10 Mar 2005 11:57:05 -0500 (EST)
(envelope-from ogauud@ogauud.com)."

Another:

Received: by mailagent1.ientrymail.com (PowerMTA(TM) v2.0r1) id
h5hp7m03us84; Mon, 7 Mar 2005 10:25:47 -0500 (envelope-from
<1.31684.3132363334303333.1.b@ientrynetwork.net>)

Resulting in:

"Invalid date and time Mon, 7 Mar 2005 10:25:47 -0500 (envelope-from
<1.31684.3132363334303333.1.b@ientrynetwork.net>)."

Examining the emails themselves showed clearly that the script was
looking at the last instance of the Received header (correctly
obviously, according to Barry's 1.0 script), which is generally the
first MTA the email hit on it's way out - so more likely the sent
time, and not the received time in my system. And of course, the odd
data appended to the headers were the result of non-standard
configuration of the sending MTA. While my inbound SMTP imap server may
also be misconfigured, at least it will be consistent ;-). And
naturally it will have the correct received time. Sort of (more later).


So I solved both problems by modifying:

repeat with aHeader in theHeaders
if aHeader starts with "Received:" then copy contents of
aHeader to receivedHeader
end repeat

with

repeat with aHeader in theHeaders
if aHeader starts with "Received:" then copy contents of
aHeader to receivedHeader
if contents of receivedHeader is not "" then exit repeat
end repeat

That results in the first Received header time being picked up. OK, all
consistent with Barry.

The next problem (which highlighted a more significant issue) is that
the script fails when it hits a timestamp that includes that odd
appendix (envelope-from ogauud@ogauud.com). I solved that by modifying:

set AppleScript's text item delimiters to {";"}
set theDate to (last text item of receivedHeader)
set time received of theMess to date theDate

to

set AppleScript's text item delimiters to {";", "("}
set theDate to (last text item of receivedHeader)
set time received of theMess to date theDate

However, it became evident that for some reason the script is not able
to deal with timezones in the time stamp. So:

Received: from mail pickup service by smtp1.bellevue.com with Microsoft
SMTPSVC;
Thu, 7 Apr 2005 12:18:27 -0000 (UTC)

results in the time being corrected to 12:18:27 rather than 05:18:27
which is correct for my local timezone. I am unable to find any
references in the Apple Scripting man pages to indicate a mechanism to
handle timestamps that include an offset. My imap server is set to UTC
so all timestamps show -0000 (UTC).

In any case, the script solved almost all the problems, and at least
brought the time stamps within range (+7 hours) ;-)). Thanks!


Multiple retrievals of the same emails by Alastair

Alastair
Thu Apr 07 18:12:02 CDT 2005

Hi,

I hope someone can help me. Entourage just downloaded all my emails (about
2000) from the server - emails from December that I had already retrieved on
my computer. Why did it do that?!

It's the second or third time it's happened. I have to then organize by
unread - and delete all the emails it just got (and screen the ones that are
from the last 10mins).

Any ideas?

Cheers,
Alastair

On 4/7/05 6:44 PM, in article
1112913861.908060.113940@o13g2000cwo.googlegroups.com, "gg@daqus.com"
<gg@daqus.com> wrote:

> The script corrects most of my munged mail... but there are some
> problems:
>
> The first - the time picked up is that in the last received header,
> which is generally the time that the mail hit the first MTA. This is
> great if the broken part of the date is the sent time, but in my case
> the sent time was fine - the received time was b0rked. When Entourage
> crashes with the imap server connected (dovecot 0.99.11), it begins
> re-receiving all of the email but uses the current time as the received
> time. Oddly enough, this became evident after a number of crashes of
> the script on a large group of emails. Examination of the event log led
> to the identification of an apparent flaw in the script:
>
> The header of a typical email that caused a crash, munged for privacy:
>
> Received: from pu.ogauud.com (ns.ogauud.com [x.x.x.x])
> by ogud.com (8.12.11/8.12.11) with ESMTP id j2AGv5qW008089;
> Thu, 10 Mar 2005 11:57:05 -0500 (EST)
> (envelope-from ogauud@ogauud.com)
>
> resulting in:
>
> "Invalid date and time Thu, 10 Mar 2005 11:57:05 -0500 (EST)
> (envelope-from ogauud@ogauud.com)."
>
> Another:
>
> Received: by mailagent1.ientrymail.com (PowerMTA(TM) v2.0r1) id
> h5hp7m03us84; Mon, 7 Mar 2005 10:25:47 -0500 (envelope-from
> <1.31684.3132363334303333.1.b@ientrynetwork.net>)
>
> Resulting in:
>
> "Invalid date and time Mon, 7 Mar 2005 10:25:47 -0500 (envelope-from
> <1.31684.3132363334303333.1.b@ientrynetwork.net>)."
>
> Examining the emails themselves showed clearly that the script was
> looking at the last instance of the Received header (correctly
> obviously, according to Barry's 1.0 script), which is generally the
> first MTA the email hit on it's way out - so more likely the sent
> time, and not the received time in my system. And of course, the odd
> data appended to the headers were the result of non-standard
> configuration of the sending MTA. While my inbound SMTP imap server may
> also be misconfigured, at least it will be consistent ;-). And
> naturally it will have the correct received time. Sort of (more later).
>
>
> So I solved both problems by modifying:
>
> repeat with aHeader in theHeaders
> if aHeader starts with "Received:" then copy contents of
> aHeader to receivedHeader
> end repeat
>
> with
>
> repeat with aHeader in theHeaders
> if aHeader starts with "Received:" then copy contents of
> aHeader to receivedHeader
> if contents of receivedHeader is not "" then exit repeat
> end repeat
>
> That results in the first Received header time being picked up. OK, all
> consistent with Barry.
>
> The next problem (which highlighted a more significant issue) is that
> the script fails when it hits a timestamp that includes that odd
> appendix (envelope-from ogauud@ogauud.com). I solved that by modifying:
>
> set AppleScript's text item delimiters to {";"}
> set theDate to (last text item of receivedHeader)
> set time received of theMess to date theDate
>
> to
>
> set AppleScript's text item delimiters to {";", "("}
> set theDate to (last text item of receivedHeader)
> set time received of theMess to date theDate
>
> However, it became evident that for some reason the script is not able
> to deal with timezones in the time stamp. So:
>
> Received: from mail pickup service by smtp1.bellevue.com with Microsoft
> SMTPSVC;
> Thu, 7 Apr 2005 12:18:27 -0000 (UTC)
>
> results in the time being corrected to 12:18:27 rather than 05:18:27
> which is correct for my local timezone. I am unable to find any
> references in the Apple Scripting man pages to indicate a mechanism to
> handle timestamps that include an offset. My imap server is set to UTC
> so all timestamps show -0000 (UTC).
>
> In any case, the script solved almost all the problems, and at least
> brought the time stamps within range (+7 hours) ;-)). Thanks!
>