schedule event on outlook from php

Solutions on MaxInterview for schedule event on outlook from php by the best coders in the world

showing results for - "schedule event on outlook from php"
Dylan
23 Mar 2020
1<?php
2
3$from_name = "Your Name";
4$from_address = "youremail@yourdomain.com";
5$to_name = "Receiver Name"
6$to_address = "receiveremail@yourdomain.com";
7$startTime = "04/15/2020 12:00:00";
8$endTime = "04/15/2020 12:30:00";
9$subject = "Reminder for event";
10$description = "eminder for event";
11$location = "Your Location";
12$domain = 'yourdomain.com';
13
14//Create Email Headers
15$mime_boundary = "----Meeting Booking----".MD5(TIME());
16
17$headers = "From: ".$from_name." <".$from_address.">\n";
18$headers .= "Reply-To: ".$from_name." <".$from_address.">\n";
19$headers .= "MIME-Version: 1.0\n";
20$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
21$headers .= "Content-class: urn:content-classes:calendarmessage\n";
22
23//Create Email Body (HTML)
24$message = "--$mime_boundary\r\n";
25$message .= "Content-Type: text/html; charset=UTF-8\n";
26$message .= "Content-Transfer-Encoding: 8bit\n\n";
27$message .= "<html>\n";
28$message .= "<body>\n";
29
30$message .= 'Demo Message';
31
32$message .= "</body>\n";
33$message .= "</html>\n";
34$message .= "--$mime_boundary\r\n";
35
36//Event setting
37$ical = 'BEGIN:VCALENDAR' . "\r\n" .
38'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" .
39'VERSION:2.0' . "\r\n" .
40'METHOD:REQUEST' . "\r\n" .
41'BEGIN:VTIMEZONE' . "\r\n" .
42'TZID:Eastern Time' . "\r\n" .
43'BEGIN:STANDARD' . "\r\n" .
44'DTSTART:20091101T020000' . "\r\n" .
45'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' . "\r\n" .
46'TZOFFSETFROM:-0400' . "\r\n" .
47'TZOFFSETTO:-0500' . "\r\n" .
48'TZNAME:EST' . "\r\n" .
49'END:STANDARD' . "\r\n" .
50'BEGIN:DAYLIGHT' . "\r\n" .
51'DTSTART:20090301T020000' . "\r\n" .
52'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' . "\r\n" .
53'TZOFFSETFROM:-0500' . "\r\n" .
54'TZOFFSETTO:-0400' . "\r\n" .
55'TZNAME:EDST' . "\r\n" .
56'END:DAYLIGHT' . "\r\n" .
57'END:VTIMEZONE' . "\r\n" .
58'BEGIN:VEVENT' . "\r\n" .
59'ORGANIZER;CN="'.$from_name.'":MAILTO:'.$from_address. "\r\n" .
60'ATTENDEE;CN="'.$to_name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$to_address. "\r\n" .
61'LAST-MODIFIED:' . date("Ymd\TGis") . "\r\n" .
62'UID:'.date("Ymd\TGis", strtotime($startTime)).rand()."@".$domain."\r\n" .
63'DTSTAMP:'.date("Ymd\TGis"). "\r\n" .
64'DTSTART;TZID="Pacific Daylight":'.date("Ymd\THis", strtotime($startTime)). "\r\n" .
65'DTEND;TZID="Pacific Daylight":'.date("Ymd\THis", strtotime($endTime)). "\r\n" .
66'TRANSP:OPAQUE'. "\r\n" .
67'SEQUENCE:1'. "\r\n" .
68'SUMMARY:' . $subject . "\r\n" .
69'LOCATION:' . $location . "\r\n" .
70'CLASS:PUBLIC'. "\r\n" .
71'PRIORITY:5'. "\r\n" .
72'BEGIN:VALARM' . "\r\n" .
73'TRIGGER:-PT15M' . "\r\n" .
74'ACTION:DISPLAY' . "\r\n" .
75'DESCRIPTION:Reminder' . "\r\n" .
76'END:VALARM' . "\r\n" .
77'END:VEVENT'. "\r\n" .
78'END:VCALENDAR'. "\r\n";
79$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST'."\n";
80$message .= "Content-Transfer-Encoding: 8bit\n\n";
81$message .= $ical;
82
83mail($to_address, $subject, $message, $headers);
84?>
85
86