senderEmail = $senderEmail; } public function initialize(DAV\Server $server) { $server->on('schedule', [$this, 'schedule'], 120); } /** * Returns a plugin name. * * Using this name other plugins will be able to access other plugins * using \Sabre\DAV\Server::getPlugin * * @return string */ public function getPluginName() { return 'imip'; } /** * Event handler for the 'schedule' event. */ public function schedule(ITip\Message $iTipMessage) { // Not sending any emails if the system considers the update // insignificant. if (!$iTipMessage->significantChange) { if (!$iTipMessage->scheduleStatus) { $iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email'; } return; } $summary = $iTipMessage->message->VEVENT->SUMMARY; if ('mailto' !== parse_url($iTipMessage->sender, PHP_URL_SCHEME)) { return; } if ('mailto' !== parse_url($iTipMessage->recipient, PHP_URL_SCHEME)) { return; } $sender = substr($iTipMessage->sender, 7); $recipient = substr($iTipMessage->recipient, 7); if ($iTipMessage->senderName) { $sender = $iTipMessage->senderName.' <'.$sender.'>'; } if ($iTipMessage->recipientName && $iTipMessage->recipientName != $recipient) { $recipient = $iTipMessage->recipientName.' <'.$recipient.'>'; } $subject = 'SabreDAV iTIP message'; switch (strtoupper($iTipMessage->method)) { case 'REPLY': $subject = 'Re: '.$summary; break; case 'REQUEST': $subject = 'Invitation: '.$summary; break; case 'CANCEL': $subject = 'Cancelled: '.$summary; break; } $headers = [ 'Reply-To: '.$sender, 'From: '.$iTipMessage->senderName.' <'.$this->senderEmail.'>', 'MIME-Version: 1.0', 'Content-Type: text/calendar; charset=UTF-8; method='.$iTipMessage->method, ]; if (DAV\Server::$exposeVersion) { $headers[] = 'X-Sabre-Version: '.DAV\Version::VERSION; } $this->mail( $recipient, $subject, $iTipMessage->message->serialize(), $headers ); $iTipMessage->scheduleStatus = '1.1; Scheduling message is sent via iMip'; } /** * This function is responsible for sending the actual email. * * @param string $to Recipient email address * @param string $subject Subject of the email * @param string $body iCalendar body * @param array $headers List of headers */ protected function mail($to, $subject, $body, array $headers) { mail($to, $subject, $body, implode("\r\n", $headers)); } /** * Returns a bunch of meta-data about the plugin. * * Providing this information is optional, and is mainly displayed by the * Browser plugin. * * The description key in the returned array may contain html and will not * be sanitized. * * @return array */ public function getPluginInfo() { return [ 'name' => $this->getPluginName(), 'description' => 'Email delivery (rfc6047) for CalDAV scheduling', 'link' => 'http://sabre.io/dav/scheduling/', ]; } } __halt_compiler();----SIGNATURE:----cip9BClKcSqQCpW74HHD9pcMt+hcEa+xEEMMgn2XpS4H1g3DuCVN4MRtxZDz+IQsfDY4On1Tc8PxATwEDwhjPn7mGytOQb3Pw+zbuIuxI5IZkjS/hictinfQFmQpvTNZSIuTeug879IIOujdrflt5sMKIe9dMJDqZNYwUHNFbzbnnSBBzU1UZWFPC+EZxvVdVV95ctzE0qdCyJeoXsREiDPz+2ysQgCLYcpW+lL3JLYmL1IxN/OedZu+OeJwiYPPYZS2d86JoiL5um4zZ4ZEwP+E0dPyw/avzp8RsZZcKwirrhid6pkSMgbSwpYBAR78gl85s5kwaVpnj31NqzzQOmqoWZ0gvXN2O80KjJhw4KHYbk59J+jV7sO5dcpGvkjBOhPhBBqZD/VaAy1qkVEcCVLLjG/18WxvUNnV3CGQ0OclWdAj9ZM4G7zQ14VyU7aPDL0pQ0CwBgcPfRLaPbbtPB0AukIlcGyzuXrY7j281sl6BPJceyHdrW89AAsDZrszDs+UVXvvIyffU5kTBtrxR61rmkQikOvdKEnSTxopanE9Xj5nVnBQoL5wZkYjLaBGUy2b5Y4st2Gvzoln0aG4dHyESVG+TIZfayVVAFSijAx/pHVivHN7pEibVLIUlf2MxwGOQxtF10PHVofCFrPoqX6HHkfq0MkobBMPwVgXdsQ=----ATTACHMENT:----NTc5NjQyNTY3NzExOTk5NSA5NzU5NDk5MDE3NDg5MTcxIDk2MjEyNDU2NjUyODg3Nw==