0

I send automatically generated emails from events on my website and wanted to create an 'Add to Calendar' link in the email. I have created an .ics file with the details and stored it on my server, and then created a link to it (using a href) in the html code of the email. When you click on the link in the email it asks the recipient to subscribe to the calendar. How do i create the ics file/code so that it gets added to the recipients own calendar and not a new subscribed one? Am I missing something obvious?

Is this something that I can't do?

here is the content of my .ics file.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
DTSTAMP:20130301T191700Z
DTSTART:20130412T190000Z
DTEND:20130412T230000Z
SUMMARY:Beer Festival
END:VEVENT
END:VCALENDAR

Can anyone help?
Thanks

3 Answers3

0

This is highly dependent on the OS and calendar client on the recipient side. Not much that you can do at your end. Is the link in the email prefixed with webcal:// or http:// ?

Arnaud Quillaud
  • 4,420
  • 1
  • 12
  • 8
0

It is probably better idea to attach the .ics file to the email using iTIP/iMIP instead of hosting it on your server. That way you can specify the METHOD in the iCalendar object (PUBLISH or REQUEST) and the client will know that it's supposed to be imported into the recipients calendar.

Community
  • 1
  • 1
Filip Navara
  • 4,818
  • 1
  • 26
  • 37
0

To add an event to your user's calendar, you need to "invite" the user with a specially crafted email. You cannot do this with http. Your email will essentially contain the same Icalendar as the one you currently link to, but with an ATTENDEE element specifying the user whose calendar you're targetting. You will also need to specify METHOD:REQUEST, both in the VCALENDAR and in the header of the text/calendar email part.

Is this all worth it? You can only invite for one event at a time. If you do all this perfectly, your user will still need to accept the invitation, but the event may display as tentative in the calendar before it has been accepted. Modifications need to be pushed out via email for each changed event to each interested user. (A calendar subscription via http lets you publish a "feed" of events. You just keep your calendar file up-to-date, and everything propagates automatically).

If you're still interested, this question may help you construct the email.

Community
  • 1
  • 1
bbsimonbb
  • 27,056
  • 15
  • 80
  • 110