I am parsing mail messages with AppleScript to process incoming mail. The main purpose is to feed appointment requests straight to iCal and to fix a strange timezone 'feature' in mail from windows
My script now manages incoming mail from windows OK, but the text it grabs from Mail.app calendar attachments is full of strange codes for spaces and c/r.
I have hacked down the script to find the problem and at it simplest:
on perform mail action with messages theMessages
tell application "Mail"
repeat with theMessage in theMessages
set theSource to the source of theMessage
set the clipboard to theSource
.....
Puts text like this into the clipboard from a mac mail attachment:
Content-Disposition: attachment;
filename=iCal-20070928-122135.ics
BEGIN:VCALENDAR=0D=0APRODID:-//Apple=20Computer\,=20Inc//iCal=202.0//EN=0D=
=0AMETHOD:REQUEST=0D=0ACALSCALE:GREGORIAN=0D=0AVERSION:2.0=0D=0A=
BEGIN:VTIMEZONE=0D=0ATZID:Africa/Nairobi=0D=0A=
LAST-MODIFIED:20070928T092135Z=0D=0ABEGIN:STANDARD=0D=0A=
DTSTART:19321213T204552=0D=0ATZOFFSETTO:+0230=0D=0ATZOFFSETFROM:+0000=0D=0A=
TZNAME:BEAT=0D=0AEND:STANDARD=0D=0ABEGIN:STANDARD=0D=0A=
DTSTART:19400101T001445=0D=0ATZOFFSETTO:+024445=0D=0ATZOFFSETFROM:+0230=0D=
=0ATZNAME:BEAUT=0D=0AEND:STANDARD=0D=0ABEGIN:STANDARD=0D=0A=
DTSTART:19600101T001515=0D=0ATZOFFSETTO:
whereas from a windows mail it puts this:
------_=_NextPart_001_01C800D9.B7B371C2
Content-class: urn:content-classes:calendarmessage
Content-Type: text/calendar;
name="meeting.ics";
method=REQUEST
Content-Transfer-Encoding: 8bit
BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:Microsoft CDO for Microsoft Exchange
VERSION:2.0
BEGIN:VTIMEZONE
TZID
GMT+03.00) East Africa/Nairobi
X-MICROSOFT-CDO-TZID:56
BEGIN:STANDARD
DTSTART:16010101T000000
TZOFFSETFROM:+0300
How do I strip out those codes in the mac version, better still how do I stop them from appearing.
Thanks
My script now manages incoming mail from windows OK, but the text it grabs from Mail.app calendar attachments is full of strange codes for spaces and c/r.
I have hacked down the script to find the problem and at it simplest:
on perform mail action with messages theMessages
tell application "Mail"
repeat with theMessage in theMessages
set theSource to the source of theMessage
set the clipboard to theSource
.....
Puts text like this into the clipboard from a mac mail attachment:
Content-Disposition: attachment;
filename=iCal-20070928-122135.ics
BEGIN:VCALENDAR=0D=0APRODID:-//Apple=20Computer\,=20Inc//iCal=202.0//EN=0D=
=0AMETHOD:REQUEST=0D=0ACALSCALE:GREGORIAN=0D=0AVERSION:2.0=0D=0A=
BEGIN:VTIMEZONE=0D=0ATZID:Africa/Nairobi=0D=0A=
LAST-MODIFIED:20070928T092135Z=0D=0ABEGIN:STANDARD=0D=0A=
DTSTART:19321213T204552=0D=0ATZOFFSETTO:+0230=0D=0ATZOFFSETFROM:+0000=0D=0A=
TZNAME:BEAT=0D=0AEND:STANDARD=0D=0ABEGIN:STANDARD=0D=0A=
DTSTART:19400101T001445=0D=0ATZOFFSETTO:+024445=0D=0ATZOFFSETFROM:+0230=0D=
=0ATZNAME:BEAUT=0D=0AEND:STANDARD=0D=0ABEGIN:STANDARD=0D=0A=
DTSTART:19600101T001515=0D=0ATZOFFSETTO:
whereas from a windows mail it puts this:
------_=_NextPart_001_01C800D9.B7B371C2
Content-class: urn:content-classes:calendarmessage
Content-Type: text/calendar;
name="meeting.ics";
method=REQUEST
Content-Transfer-Encoding: 8bit
BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:Microsoft CDO for Microsoft Exchange
VERSION:2.0
BEGIN:VTIMEZONE
TZID
X-MICROSOFT-CDO-TZID:56
BEGIN:STANDARD
DTSTART:16010101T000000
TZOFFSETFROM:+0300
How do I strip out those codes in the mac version, better still how do I stop them from appearing.
Thanks