Skip to content

Instantly share code, notes, and snippets.

@donaldallen
Last active December 17, 2015 19:09
Show Gist options
  • Save donaldallen/5658401 to your computer and use it in GitHub Desktop.
Save donaldallen/5658401 to your computer and use it in GitHub Desktop.
<?php
$ical = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:" . md5(uniqid(mt_rand(), true)) . "@domain.com
DTSTAMP:" . gmdate('Ymd')."T". gmdate('His') . "Z
DTSTART:" . $start_date->format('Ymd') . "T" . $start_date->format('Hi') . "00Z
DTEND:" . $end_date->format('Ymd') . "T" . $end_date->format('Hi') . "00Z
SUMMARY:Events - " . $this->input->post('event_name') . "
END:VEVENT
END:VCALENDAR";
$this->load->library('email');
$this->email->from('[email protected]', 'Your Name');
$this->email->to($this->input->post('email'));
$this->email->subject($this->input->post('event_name'));
$this->email->message('Testing the ics attachment.');
$this->email->attach($ical, 'attachment', 'event.ics', 'text/calendar');
$this->email->send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment