Problem: I send ICS files as attachments and from
some outlooks I get back a winmail.dat as confirmation
Hi!
I had to write a tool which creates outlook appointments using
an applicationserver like PHP, ASP or similar.
I create a ICS file and send it as a attachment to different receivers. That works
very well.
The receivers can confirm or decline those appointsments and outlook
generates email back to my system. My outlook and other test
installations create email which are readable for me:
----------------------------------
[...mail headers...]
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REPLY
BEGIN:VEVENT
ORGANIZER:MAILTO:xxxxxxxxx@aon.at
DTSTART:20080213T090000Z
DTEND:20080213T093000Z
TRANSP:OPAQUE
SEQUENCE:0
UID:epluscrm103
DTSTAMP:20080204T160005Z
SUMMARY:Accepted: 2222 Bitte diesen termin dem kalender hinzufuegen -
muss
wissen\, wie die bestaetiugng aussieht KUNNR 0000228001
PRIORITY:5
X-MICROSOFT-CDO-IMPORTANCE:1
CLASS:PUBLIC
ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:eplus@xxxxxx.invalid
END:VEVENT
END:VCALENDAR
----------------------------------
but the outlook of my customer sends a damned winmail.dat:
----------------------------------
[...mail headers...]
Content-Type: multipart/mixed;
boundary="----_=_NextPart_001_01C86745.00C076DC"
Subject: Zugesagt: TEST-040208 KUNNR 0000228001
Date: Mon, 4 Feb 2008 16:45:45 +0100
Message-ID:
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: TEST-040208 KUNNR 0000228001
thread-index: AchnRP5XqUVAPrFtTUKKGcbevQFe0wAAALQw
From: "Wxxxxx Johann"
To: "xxxxxx CRM"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C86745.00C076DC
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
------_=_NextPart_001_01C86745.00C076DC
Content-Type: application/ms-tnef;
name="winmail.dat"
Content-Transfer-Encoding: base64
eJ8+Ii0PAQaQCAAEAAAAAAABAAEAAQeQBgAIAAAA5AQAAAAAAADoAAEIgAcAIAAAAElQTS5NaWNy
b3NvZnQgU2NoZWR1bGUuTXRnUmVzcFAAVwsBDYAEAAIAAAACAAIAAQSAAQAoAAAAWnVnZXNhZ3Q6
IFRFU1QtMDQwMjA4ICBLVU5OUiAwMDAwMjI4MDAxABoKAQWAAwAOAAAA2AcCAAQAEAAtAC0AAQBQ
AQEGAAMADgAAANgHAgAEABEAAAAAAAEA9wABBwADAA4AAADYBwIABAARAB4AAAABABUBAQgABQAE
AAAA//////wDASCAAwAOAAAA2AcCAAQAEAAtACwAAQBPAQEJgAEAIQAAADY1MzQ3MTc5OTQyQUM0
NDU5MDE2MjAzRjg3Qjk4MzU0ANMGAQOQBgCsDwAAeQAAAAsAAgABAAAAAwAmAAAAAAALACsAAAAA
AAMANgAAAAAAQAA5AIAaKgFFZ8gBHgA9AAEAAAALAAAAWnVnZXNhZ3Q6IAAAAgFHAAEAAAA0AAAA
Yz1BVDthPSA7cD1MaWJybztsPUxJQkFURVhDSDE0LTA4MDIwNDE1NDU0NFotMTA3NDgyAEAAYAAA
wMj+RmfIAUAAYQAA9KovS2fIAR4AcAABAAAAHgAAAFRFU1QtMDQwMjA4ICBLVU5OUiAwMDAwMjI4
MDAxAAAAAgFxAAEAAAAbAAAAAchnRP5XqUVAPrFtTUKKGcbevQFe0wAAALQwAB4AGgwBAAAADwAA
----------------------------------
Of course I can decode this encode64 part but all I get is a
absolutely unreadable winmail.dat. There are many tools which should
be able to convert the winmail.dat code but they are not working very
well.
The template for my ICS looks like that:
BEGIN:VCALENDAR
PRODID:-//CMS42 by lemon42//EPLUS CRM//EN
VERSION:2.0
METHOD:{method}
BEGIN:VEVENT
ORGANIZER;CN="EPLUS CRM":MAILTO:{fromemail}
DTSTART:{timestart}
DTEND:{timeend}
LOCATION:{location}
TRANSP:OPAQUE
SEQUENCE:0
UID:{uid}
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN="'{empfaengeremail}'":MAILTO:{empfaengeremail}
DTSTAMP:{timestam}
DESCRIPTION:{description}\n
SUMMARY:{subject}
PRIORITY:5
CLASS:PUBLIC
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
{status}
END:VEVENT
END:VCALENDAR
Solution:
decode64 the attachment, so you get the winmail.dat.
Search for "MtgResp" in the binary. The next byte is the status:
MtgRespP = Accepted
MtgRespA = Tentative
MtgRespN = Declined
To identify the appointment ID you should use a prefix for your
appointment. My script uses:
UID:epluscrm103
So I look for "epluscrm" in the unreadable binary trash and take all
bytes till the next 00-byte.
Comments are welcome. Use my contact form.
|