What is iCal attachment
iCal attachment isn event that we put into the email so that when the receiver will click the it, an event will be added to his calendar. It looks like this in email:
Example of iCal attachment format for IPL Match on Friday 09/30/2016 between India and Pakistan at Mohali stadium is following:
BEGIN:VCALENDAR VERSION:2.0 PRODID:-abcabcevent CALSCALE:GREGORIAN BEGIN:VTIMEZONE TZID:Asia/Kolkata TZURL:http://tzurl.org/zoneinfo-outlook/Asia/Kolkata X-LIC-LOCATION:Asia/Kolkata BEGIN:STANDARD TZOFFSETFROM:+0530 TZOFFSETTO:+0530 TZNAME:IST DTSTART:19700101T000000 END:STANDARD END:VTIMEZONE BEGIN:VEVENT DTSTAMP:20160908T094856Z DTSTART;VALUE=DATE:20160930 SUMMARY:IPL Match URL:www.starsports.com DESCRIPTION:IPL Match in India Pakistan LOCATION:Mohali END:VEVENT END:VCALENDAR
How to achieve it in emails sent through code
How to send ical attachment in email through code using sendgrid:
//assign format to a variable $ical = "BEGIN:VCALENDAR VERSION:2.0 PRODID:-abcabcevent CALSCALE:GREGORIAN BEGIN:VTIMEZONE TZID:Asia/Kolkata TZURL:http://tzurl.org/zoneinfo-outlook/Asia/Kolkata X-LIC-LOCATION:Asia/Kolkata BEGIN:STANDARD TZOFFSETFROM:+0530 TZOFFSETTO:+0530 TZNAME:IST DTSTART:19700101T000000 END:STANDARD END:VTIMEZONE BEGIN:VEVENT DTSTAMP:20160908T094856Z DTSTART;VALUE=DATE:20160930 SUMMARY:IPL Match URL:www.starsports.com DESCRIPTION:IPL Match in India Pakistan LOCATION:Mohali END:VEVENT END:VCALENDAR"; //prepare an array of parameters $params = array( 'api_user' => $user, 'api_key' => $pass, 'to' => $to, 'from' => $from, 'subject' => $subject, 'html' => $body, 'files[ical.ics]' => $ical );
Send email with iCal.ics file as attachment shown in email like
Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at webdevelopment@webners.com