protected function addAttachment() { global $ilUser; include_once './Services/Calendar/classes/Export/class.ilCalendarExport.php'; $export = new ilCalendarExport(); $export->setExportType(ilCalendarExport::EXPORT_APPOINTMENTS); $export->setAppointments(array($this->getAppointmentId())); $export->export(); include_once './Services/Mail/classes/class.ilFileDataMail.php'; $attachment = new ilFileDataMail($this->getSender()); $attachment->storeAsAttachment('appointment.ics', $export->getExportString()); $this->setAttachments(array('appointment.ics')); }