icalendar - Adding events to Outlook calendar via PHP

one text

I currently have the following code that I use which creates a .ics file with a calendar event. When I receive the email, I have to open the .ics file, then Save & Close for the event to be saved to my calendar. I have two questions:

  1. Is there a way to automate this so as soon as the email is received, the event is added to my calendar without having to open and save the .ics file? The email is being sent from my company's primary account to users within my company. I've tried changing the sender to be the same as the recipient, but that didn't make a difference.
  2. If #1 isn't possible, what do I need to fix to be able to create the event in Outlook for iOS? The .ics file won't open in Outlook for iOS, so I have to do it on my desktop.

TIA

$ical_content = "BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VTIMEZONE"
.$adtimezone."
END:VTIMEZONE
BEGIN:VEVENT
CREATED:".$createdDate."
DESCRIPTION:".$appNotefinal."
DTEND;TZID=\"".$appTimeZone."\":".$endDateTime."
DTSTAMP:".$createdDate."
DTSTART;TZID=\"".$appTimeZone."\":".$startDateTime."
LAST-MODIFIED:".$createdDate."
LOCATION:".$appLocation."
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=en-us:".$appSubject." - ".$clientusername."
".$reminderinfo;

Source