function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BenzyBenzy 

Visualforce email with .ics attachment that works with Gmail

Hi,

I have created a visualforce email template that contains a .ics calendar invite attachment. The attachment works fine for desktop/phone apps. But Gmail (using the web interface) will not recognise the .ics file and give the "Add to Calendar" option in the message. 

What I want is for the attached invite to appear in the email as so:
User-added image
Instead, it just appears as a regular attachment, with the only option being to download it.

I have created a calendar event in google calendar, downloaded it and emailed it to myself, and it works as per the image above. However, I put the exact same code in my VF template and send a test, and the invite doesn't work as above.

Here is my vf code (note that there are no merge fields in the invite code because I'm simply trying to get a basic invite to work). Can anyone see where I am going wrong? Thanks
 
<messaging:emailTemplate subject="Leave Request Approved" recipientType="User" relatedToType="Leave_Request__c">
<messaging:htmlEmailBody >
<html>

<style type="text/css">
...my styling...
</style>

<body>
 
...my body content...

</body>
</html>
</messaging:htmlEmailBody>
 
<messaging:attachment filename="reminder.ics">
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
STATUS:CONFIRMED
CREATED:20150507T054355Z
UID:qjvkvr7gsf10erbp9vc2fk05ec@google.com
DTEND;VALUE=DATE:20150510
TRANSP:TRANSPARENT
SUMMARY:Test Summary
DTSTART;VALUE=DATE:20150508
DTSTAMP:20150507T054355Z
LAST-MODIFIED:20150507T054355Z
SEQUENCE:0
DESCRIPTION:Test Description
END:VEVENT
END:VCALENDAR
</messaging:attachment>
 
</messaging:emailTemplate>

 
Janardhanan J 1Janardhanan J 1
Hi Benzy,
                I have a similar requirement as yours. Were you able to get this issue resolved? if yes, please provide you valuable inputs.


Thanks
Jana