Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
vcal
:
vcal06.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /// https://www.exchangecore.com/blog/sending-outlook-email-calendar-events-php date_default_timezone_set('Europe/Paris'); ///Central Europe Standard CEST function sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location) { $domain = 'exchangecore.com'; //Create Email Headers $mime_boundary = "----Meeting Booking----".MD5(TIME()); $headers = "From: ".$from_name." <".$from_address.">\n"; $headers .= "Reply-To: ".$from_name." <".$from_address.">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n"; $headers .= "Content-class: urn:content-classes:calendarmessage\n"; //Create Email Body (HTML) $message = "--$mime_boundary\r\n"; $message .= "Content-Type: text/html; charset=UTF-8\n"; $message .= "Content-Transfer-Encoding: 8bit\n\n"; $message .= "<html>\n"; $message .= "<body>\n"; $message .= '<p>Dear '.$to_name.',</p>'; $message .= '<p>'.$description.'</p>'; $message .= "</body>\n"; $message .= "</html>\n"; $message .= "--$mime_boundary\r\n"; $ical = 'BEGIN:VCALENDAR' . "\r\n" . 'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" . 'VERSION:2.0' . "\r\n" . 'METHOD:REQUEST' . "\r\n" . 'BEGIN:VTIMEZONE' . "\r\n" . 'TZID:Central Europe Standard Time' . "\r\n" . //'TZID:Europe/Paris' . "\r\n" . 'BEGIN:STANDARD' . "\r\n" . 'DTSTART:20091101T020000' . "\r\n" . 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' . "\r\n" . 'TZOFFSETFROM:+0300' . "\r\n" . 'TZOFFSETTO:+0200' . "\r\n" . 'TZNAME:CEST' . "\r\n" . 'END:STANDARD' . "\r\n" . 'BEGIN:DAYLIGHT' . "\r\n" . 'DTSTART:20090301T020000' . "\r\n" . 'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' . "\r\n" . 'TZOFFSETFROM:+0300' . "\r\n" . 'TZOFFSETTO:+0200' . "\r\n" . 'TZNAME:CEST' . "\r\n" . 'END:DAYLIGHT' . "\r\n" . 'END:VTIMEZONE' . "\r\n" . 'BEGIN:VEVENT' . "\r\n" . 'ORGANIZER;CN="'.$from_name.'":MAILTO:'.$from_address. "\r\n" . 'ATTENDEE;CN="'.$to_name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$to_address. "\r\n" . 'LAST-MODIFIED:' . date("Ymd\TGis") . "\r\n" . 'UID:'.date("Ymd\TGis", strtotime($startTime)).rand()."@".$domain."\r\n" . 'DTSTAMP:'.date("Ymd\TGis"). "\r\n" . 'DTSTART;TZID="Central Europe Standard Time":'.date("Ymd\THis", strtotime($startTime)). "\r\n" . 'DTEND;TZID="Central Europe Standard Time":'.date("Ymd\THis", strtotime($endTime)). "\r\n" . //'DTSTART;TZID="Europe/Paris":'.date("Ymd\THis", strtotime($startTime)). "\r\n" . //'DTEND;TZID="Europe/Paris Standard Time":'.date("Ymd\THis", strtotime($endTime)). "\r\n" . 'TRANSP:OPAQUE'. "\r\n" . 'SEQUENCE:1'. "\r\n" . 'SUMMARY:' . $subject . "\r\n" . 'LOCATION:' . $location . "\r\n" . 'CLASS:PUBLIC'. "\r\n" . 'PRIORITY:5'. "\r\n" . 'BEGIN:VALARM' . "\r\n" . 'TRIGGER:-PT180M' . "\r\n" . 'ACTION:DISPLAY' . "\r\n" . 'DESCRIPTION:Reminder' . "\r\n" . 'END:VALARM' . "\r\n" . 'END:VEVENT'. "\r\n" . 'END:VCALENDAR'. "\r\n"; $message .= 'Content-Type: text/calendar;name="xxmeeting.ics";method=REQUEST'."\n"; $message .= "Content-Transfer-Encoding: 8bit\n\n"; $message .= $ical; $mailsent = mail($to_address, $subject, $message, $headers); //$mailsent = mail($to_address, $subject, "message" ); return ($mailsent)?(true):(false); } $from_name = "Site massage"; $from_address = "webmaster@example.com"; $to_name = "Le boulet..."; $to_address = "delpypatrice@gmail.com"; $to_address = "patrice.delpy@onsemi.com"; $startTime = "04/04/2020 10:00:00"; // 7 $endTime = "04/04/2020 11:00:00"; // 8 $subject = "Confirmation de votre réservation"; $description = "Massage"; $location = "Salle de repos"; $retour = sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location); if($retour == true) { echo "BINGO............."; } else { echo "ERROR"; } ?>