Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.3: Enable Windows Outlook users to read iCal invitations Apps

After moving to iCal, Mail.app and Address Book in Panther, I've wiped Entourage X from my TiBook (after importing mail, contacts and meetings, that is) and haven't looked back! Actually, that's not entirely true: Why doesn't Outlook for Windows like iCal invitations sent through Mail.app? If you haven't seen it first hand from a co-worker, Outlook displays all the meeting info, but complains that it can't find the event on their calendar, nor are they allowed to Accept/Reject it (all of the buttons are grayed out)!.

It turns out that Outlook needs the following mail header to be included in the E-MAIL that contains the invite, rather than just having a 'meeting.ics' file attached:

content-class: urn:content-classes:calendarmessage
The problem is that Mail.app doesn't allow you to change the mail headers for only selected e-mails; it's either an all or nothing deal (see this hint. It turns out that the e-mail is generated and sent via an AppleScript, which can be modified to use whatever e-mail client you'd like.

So, I've modified it to use the sendmail program bundled with OS X, since you can include whatever headers you like. Below is the new AppleScript that you can drop in.

WARNINGS
ALWAYS ALWAYS ALWAYS make a backup of a file before making modifications to it, or you'll be sorry. This script requires that you have a mail relay running that the SENDMAIL command can use. In my case, I'm using Postfix in Panther.

You can find the AppleScript to modify at /Applications -> iCal.app -> Contents -> Resources -> Mail.scpt (for the uninitiated, you control-click on the iCal icon and select Show Package Contents to get to Contents).

Again my warning: If you've navigated through the Finder, highlight Mail.scpt and hit Command-D right now. If you've gone the Terminal route, type cp Mail.scpt Mail.scpt.bak and hit Return.

The function you have to modify is send_mail_sbrp() -- you can leave all the others alone, so I'm only including the code for this one function. iCal will no longer send invitations through Mail.app, but will still retrieve your e-mail address and name from it (or present you with a list of choices if you have multiples, though if you have multiple e-mail addresses on one account, it will only use the first).


on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
 set pfile to POSIX file invitationPath
 set myfile to pfile as alias
  
 try
  -- define a carriage return
  set cr to (ASCII character 13) & (ASCII character 10)
    
  -- retrieve the user's name and e-mail
  set listOfAccounts to {}
    
  tell application "Mail"
   repeat with oneAccount in every account
    set listOfAccounts to listOfAccounts & 
    {"\"" & (get full name in oneAccount) & "\" <" & 
    (get email addresses in oneAccount) & ">"}
   end repeat
  end tell
    
  if ((get length of listOfAccounts) is 1) then
   set theAccountTouse to get first item of listOfAccounts
  else
   set theAccountTouse to 
   choose from list listOfAccounts 
   default items (get first item of listOfAccounts) 
   with prompt 
   "Please select which mail account to send the invitation from:" 
   without multiple selections allowed and empty selection allowed
  end if
    
  -- open and read the iCal event file to insert into an e-mail
  set myEventFileHandle to 
  open for access myfile without write permission
   set myEventFileContent to read myEventFileHandle
  close myEventFileHandle
    
  -- pre-pend mail headers to the event contents
  set myNewEmailText to 
  "Subject: " & subjectLine & cr & 
  "From: " & theAccountTouse & cr & 
  "To: " & myrecipient & cr & 
  "content-class: urn:content-classes:calendarmessage" & cr & 
  "Content-Type: text/calendar;" & cr & 
  "  method=REQUEST;" & cr & 
  "  name=\"meeting.ics\"" & cr & 
  "Content-Transfer-Encoding: 8bit" & cr & cr & 
  myEventFileContent
    
  -- create a random event file name
  set tempMailName to (random number from 1 to 1000000) & ".ics"
  set aliasTempMail to "/tmp/" & tempMailName
    
  -- write the new e-mail to a temp file
  set myEventFileHandle to 
  open for access (POSIX file aliasTempMail as string) with write permission
  write myNewEmailText starting at 1 to myEventFileHandle
  close myEventFileHandle
    
  -- use SENDMAIL to send the file with proper headers
  do shell script "sendmail < " & aliasTempMail
    
  -- delete the temp file
  do shell script "rm " & aliasTempMail
  on error errMsg
   display dialog errMsg
 end try
end send_mail_sbrp
    •    
  • Currently 2.22 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (9 votes cast)
 
[85,298 views]  

10.3: Enable Windows Outlook users to read iCal invitations | 14 comments | Create New Account
Click here to return to the '10.3: Enable Windows Outlook users to read iCal invitations' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: macsolve on Dec 27, '03 05:59:08PM
For Eudora, the script function could look like this (untested with Windows Outlook):

on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
	set pfile to POSIX file invitationPath
	set myfile to pfile as alias
	tell application "Eudora"
		set mymail to (make message at (end of mailbox "Out" of mail folder ""))
		tell mymail
			set field "Subject" to subjectLine
			set field "" to messageText
			set field "To" to myrecipient
			set field "content-class" to "urn:content-classes:calendarmessage"
		end tell
		attach to message mymail documents {myfile}
		queue mymail
	end tell
end send_mail_sbrp


[ Reply to This | # ]
Why doesn't Apple provide this?
Authored by: jscotta on Dec 29, '03 01:48:42PM

OK. If it is this simple to bring iCal compatibility to the other 95%, why doesn't Apple already have this set up or, at least a preference that can be set to make iCal invitations Outlook compatible?

---
Windows because I have to. OS X because I want to.



[ Reply to This | # ]
10.3: Enable Windows Outlook problem
Authored by: pairof9s on Dec 29, '03 04:39:52PM
I've set everything up but cannot seem to get this to work properly. Here's what will work:
    Mail.app can send mail to both non-Outlook and Outlook users via sendmail w/ my Outlook address
    Mail.app can send mail to both non-Outlook and Outlook users via POP w/ my non-Outlook address (Earthlink account)
    iCal can send invite to non-Outlook users via sendmail w/ my Outlook address
    iCal can send invite to non-Outlook users via POP w/ my non-Outlook address (Earthlink account)

Here's what doesn't work:
    iCal cannot send invite to Outlook users via sendmail w/ my Outlook address
    iCal cannot send invite to Outlook users via POP w/ my non-Outlook address (Earthlink account)


I don't receive error messages or kickbacks when iCal sends invites to Outlook users. The email just doesn't show up for these users. I suspect that this may be due to our company's use of Exchange Server 5.5. It seems any and all Exchange solutions for Mac X users these days require at least Exchange Server 2000. If anyone has suggestions to the contrary, your help is appreciated!

[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: paulforrester on Jan 14, '04 12:56:40PM
I found that this didn't work well for windows outlook users. From what I can see, outlook doesn't like the TIMEZONE info that iCal puts into the invitation. I modified the script to strip out all timezone info and now it is working well for our company.

on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
	set pfile to POSIX file invitationPath
	set myfile to pfile as alias
	
	try
		-- define a carriage return
		set cr to (ASCII character 13) & (ASCII character 10)
		
		-- retrieve the user's name and e-mail
		set listOfAccounts to {}
		tell application "Mail"
			repeat with oneAccount in every account
				set listOfAccounts to listOfAccounts & 
					{"\"" & (get full name in oneAccount) & "\" <" & 
						(get email addresses in oneAccount) & ">"}
			end repeat
		end tell
		
		if ((get length of listOfAccounts) is 1) then
			set theAccountTouse to get first item of listOfAccounts
		else
			set theAccountTouse to 
				choose from list listOfAccounts 
					default items (get first item of listOfAccounts) 
					with prompt 
					
						"Please select which mail account to send the invitation from:" without multiple selections allowed and empty selection allowed
		end if
		
		-- open and read the ical event file to insert into an e-mail
		set myEventFileHandle to 
			open for access myfile without write permission
		set myEventFileContent to read myEventFileHandle
		close myEventFileHandle
		
		-- remove the timezone info from the calendar event
		-- to make compatable with outlook
		set toss to false
		set newEventFileContent to ""
		set last_line to false
		repeat with theLine in paragraphs of myEventFileContent
			if theLine contains "BEGIN:VTIMEZONE" then
				set toss to true
			else if theLine contains "END:VTIMEZONE" then
				set last_line to true
				set toss to false
			end if
			if toss is false then
				if last_line is true then
					set last_line to false
				else
					set newEventFileContent to newEventFileContent & theLine & cr
				end if
			end if
		end repeat
		set myEventFileContent to newEventFileContent
		
		-- pre-pend mail headers to the event contents
		set myNewEmailText to 
			"From: " & theAccountTouse & cr & 
			"To: " & myrecipient & cr & 
			"Subject: " & subjectLine & cr & 
			"MIME-Version: 1.0" & cr & 
			"Content-Type: text/calendar;  method=REQUEST;" & cr & 
			"	charset=\"utf-8\"" & cr & 
			"Content-Transfer-Encoding: 8bit" & cr & 
			"Importance: Normal" & cr & cr & 
			myEventFileContent
		--			"  name=\"meeting.ics\"" & cr & 
		
		-- create a random event file name
		set tempMailName to (random number from 1 to 1000000) & ".ics"
		set aliasTempMail to "/tmp/" & tempMailName
		
		-- write the new e-mail to a temp file
		set myEventFileHandle to 
			open for access (POSIX file aliasTempMail as string) with write permission
		write myNewEmailText starting at 1 to myEventFileHandle
		close myEventFileHandle
		
		-- use SENDMAIL to send the file with proper headers
		do shell script "sendmail < " & aliasTempMail
		
		-- delete the temp file
		do shell script "rm " & aliasTempMail
	on error errMsg
		display dialog errMsg
	end try
end send_mail_sbrp


[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: strandbygaard on Jan 19, '04 06:33:37PM

I have a slight modification to paulforrester's solution to the timezone problem with Outlook.

It seems that if every line between BEGIN:VTIMEZONE and END:VTIMEZONE are removed, Outlook will not handle differences in timezones correctly. At least that is the problem I'm having with Outlook 2003 users. I haven't tested this with other versions of Outlook.

For me, the solution to this timezone problem, was to only remove a subset of the VTIMEZONE block, and the code should read BEGIN:STANDARD .... END:STANDARD instead of BEGIN:VTIMEZONE ... END:VTIMEZONE



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: melmaninga on Jan 20, '04 03:22:07PM

In my environment we are using Outlook 2003 as well and the previous versions of the script didn't work. Can you post the script that you are using in it's entirety, as I am an AppleScript newbie and I wasn't quite able to follow the changes highlighted in your post?



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: nestorph on Dec 01, '04 11:34:11AM

Sorry to report that the scripts don't work with 1.5.4. With the first script, the Outlook users calendar comes up with an untitled meeting (in the right time and date), but no option to accept the invitation (options are greyed out). Using the second script, the Outlook user gets an email with no contents.



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: gent99 on Jan 22, '04 08:22:14AM

This is what i got in /var/log/mail.log:

Jan 22 14:15:30 localhost postfix/postdrop[371]: warning: unable to look up public/pickup: No such file or directory

when i try to send an invitation to myself

Can someone help me out of this?



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: rouet on Feb 11, '04 05:26:12AM

hi
you to have to start postfix
in a terminal window do the following commands :
sudo postfix check
sudo postfix start

JR



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: keithwblom on Jan 23, '04 05:50:28PM

This fix worked fine for me, albeit unidirectionally. WinOutlook users can now accept my invitations and automatically add them to their calendar, however they are not given an option to confirm with a return email "receipt" to let me know they are able to attend. I haven't a clue if this would be the reuslt of the content in the original invitation not providing a return path, or if the WinOutlook application isn't recognizing the invitation as anything more than a "heads-up".

Does anyone have any insight into this? I run Panther on a PB, my WinOutlook invitee is on an IBM ThinkPad running Win2000 and Office2000.



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: carlmuck on Feb 13, '04 11:55:57AM

I've partially figured this out. Seems that iCal is looking for the attendee to match the "common name." iCal replys include:

ATTENDEE:CN="Carl Muckenhirn";PARTSTAT=ACCEPTED:mailto:

Outlook replys look like:

ATTENDEE;PARTSTAT=ACCEPTED:mailto:

If I take the outlook .ics and put in the "CN" portion then iCal correctly notifies you that "" accepted, but it doesn't change the status for the individual (the badge next to the attendee's name is still a "?").

go figure.

carl.



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: nestorph on Apr 27, '04 04:16:23PM

Is this script still working with iCal 1.5.2? I tried using it and iCal doesn't send out the invitations as an attachment, but simply as text within the message. When I changed the script back to the original that came with iCal, the invitation is sent out as an attachment (but, of course, it doesn't get read properly by Outlook).
Nestor



[ Reply to This | # ]
10.5.4: Enable Windows Outlook users to read iCal invitations (update)
Authored by: grok777 on Jul 31, '08 07:05:44PM
I was able to get this to work to some extent again for 10.5.4 / iCal 3.0.4, but I still ran into a few problems. One thing that has changed is the signature of the handler:

WAS
on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)

NOW IS
on send_mail_sbrp(subjectLine, messageText, myrecipient, myrecipientname, invitationPath)

Thus, when you copy the above scripts, only copy the body. Don't grab the first line. Once I did this, sendmail gave me an error that the recipient was not specified so I had to change the sendmail command to use the "-t" flag:

do shell script "sendmail -t< " & aliasTempMail

However, I am still stuck, because even though the log shows me that the message was received, it never returns a success response. Also, I never receive the message (this excerpt is from /var/log/mail.log):

Jul 31 21:21:21 mymac postfix/pickup[361]: E0BF714AAF5: uid=501 from=<grok777>
Jul 31 21:21:21 mymac postfix/cleanup[363]: E0BF714AAF5: message-id=<20080801012121.E0BF714AAF5@mymac.localhost>
Jul 31 21:21:21 mymac postfix/qmgr[362]: E0BF714AAF5: from=<grok777@mymac.localhost>, size=1427, nrcpt=1 (queue active)
Jul 31 21:21:22 mymac postfix/smtp[366]: E0BF714AAF5: to=<testaddress@mycompany.com>, relay=server.mycompany.com[143.165.224.81]:25, delay=1.1, delays=0.52/0.05/0.27/0.3, dsn=2.0.0, status=sent (250 2.0.0 m711LLxU029840 Message accepted for delivery)
Jul 31 21:21:22 mymac postfix/qmgr[362]: E0BF714AAF5: removed
Jul 31 21:22:21 mymac postfix/master[360]: master exit time has arrived

Does anyone know what I need to do to sendmail to get it working properly?

[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: jon@zamain.com on Jun 03, '10 10:02:30AM
Hi Guys,

Been dealing with a similar issue for about 3 years now, so I know your pain. Apple will not solve this problem because they're a stickler for standards, no matter what the rest of the world really needs. Since I'm a developer at heart, I decided to tackle the problem on my own and built a software product cal Zamain for Mac to resolve the Apple iCal to Microsoft Outlook/Exchange incompatibilities. I originally built the product for myself, but soon realized that this can help others as well. Here are the major issues that Zamain for Mac resolves:
  • Supports sending Apple iCal invitations from multiple Apple Mail email accounts
  • Resolves the "unable to Accept" Apple iCal invitations sent to Microsoft Outlook/Exchange recipients
  • Resolves incorrect time zones for Microsoft Outlook/Exchange recipients
  • Prevents multiple attachments when viewing Apple iCal invitation emails in Microsoft Outlook
Although I know that this is a shameless plug for my product, I urge you to give it a try because it will really make your life easier. I have been using it every day for past 6 months and I can tell you that it saved me a lot of grief.

You can get Zamain for Mac at www.zamain.com.

Thanks!

-Jon

[ Reply to This | # ]