Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICS Already Include in Body for Outlook/Gmail... but not for Office 365 #143

Open
RulianZB opened this issue Oct 15, 2024 · 0 comments
Open

Comments

@RulianZB
Copy link

Hi, i got a big problems with the mail including ICS.
I am using Laravel 11 and spatie/icalendar-generator 2.8

First i was including the ICS like an attachment :

attachData($this->generateLeaveICS($this->data['leave']), 'name.ics', [
    'mime' => 'text/calendar; charset=UTF-8; method=REQUEST',
])

But our security blocks ICS files, so I had to include these ICS directly in the body of the Mail via a symphony function.

$mailable->withSymfonyMessage(function (Email $email) use ($leave, $mailable) {
     $ics = $this->generateLeaveICS($leave);

     $htmlContent = (string) $mailable->markdown('mailing::email')->render();

     $htmlPart = new TextPart($htmlContent, 'utf-8', 'html');
     $calendarPart = new TextPart($ics, 'utf-8', 'calendar');

     $email->setBody(new MixedPart($htmlPart, $calendarPart));
});

Since I put this code in place, the invitation is interpreted correctly by Outlook and Gmail, but keeps an ICS file named ATT00001.ics on outlook.office365.com. However, I added specific headers to MSO such as X-MS-Has-Attach, X-MS-TNEF-Correlator, Accept-Language, Content-Language, x-ms-exchange-calendar-series-instance- id. I even tried to transform multipart/mixed into multipart/alternative but without any success. Do you have any ideas that could help me move forward on this issue?

Here is my ICS content that is validated by iCalendar Validator :

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN
NAME:CONGES
X-WR-CALNAME:CONGES
METHOD:REQUEST
BEGIN:VEVENT
UID:670e87ac9b0fe
DTSTAMP:20241015T151804Z
SUMMARY:CONGES
ATTENDEE;CN=Admin:MAILTO:[email protected]
DTSTART:20241017T000000
DTEND:20241017T235900
END:VEVENT
END:VCALENDAR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant