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

IOS 13 problem #1880

Closed
Giulo77 opened this issue Nov 5, 2019 · 16 comments
Closed

IOS 13 problem #1880

Giulo77 opened this issue Nov 5, 2019 · 16 comments

Comments

@Giulo77
Copy link

Giulo77 commented Nov 5, 2019

Hi,
I've been using phpmailer from 2 years to send event invite without any problem: on android and iphone phones are automatically recognized for outlook I have to click on the ics attachment.
Problem is with new update IOS 13 that not working.
First I had to keep the SEQUENCE property progressive otherwise the first event update didn't recognize the event anymore (Evident that before was based only and exclusively on the ID event).
Now I do not appear anymore the buttons yes / no / maybe but this I think because it doesn't recognize the multipart anymore.
So now it only works by clicking on the ics attachment with the problem that once I save the event I can't delete it from the calendar unless the organizer delete it.
I tried to specify the property CLASS: PUBBLIC but nothing.
With IOS 10 it works correctly.

@Giulo77
Copy link
Author

Giulo77 commented Nov 5, 2019

Here my code example:

` $mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPSecure = $_SESSION['SMTPSecure'];
$mail->Host = $_SESSION['mailerServer'];
$mail->Port = $_SESSION['STMPPort'];
$mail->SMTPAuth = true;
$mail->Username = $_SESSION['mailerAddress'];
$mail->Password = $_SESSION['mailerPassword'];
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->IsHTML(true);
$mail->CharSet='utf-8';

    $mail->From = $_SESSION['mailerAddress'];
    $mail->FromName = $_SESSION['login_name'];  

    $mail->addAddress($mailReferente);
	
$mail->AddCustomHeader("X-Confirm-Reading-To: " . $_SESSION['mailerAddress']);
    $mail->AddCustomHeader("Return-receipt-To: " . $_SESSION['mailerAddress']); 
    $mail->AddCustomHeader("Disposition-Notification-To: " . $_SESSION['mailerAddress']);			

    $ical = "BEGIN:VCALENDAR\r\n";
    $ical .= "VERSION:2.0\r\n";
    $ical .= "PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN\r\n";
    $ical .= "METHOD:REQUEST\r\n";
	$ical .= "X-MS-OLK-FORCEINSPECTOROPEN:TRUE\r\n";
    $ical .= "BEGIN:VEVENT\r\n";
    $ical .= "ORGANIZER;CN=\"" . $_SESSION['login_name'] . "\":mailto:" . $_SESSION['mailerAddress'] . "\r\n";
    $ical .= "ATTENDEE;CN=\"" . trim($referente) . "\";ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:" . $mailReferente . "\r\n";
    $ical .= "X-WR-RELCALID:" . $meeting_id . "\r\n";
    $ical .= "UID:" . $meeting_id . "\r\n";
	$ical .= "DTSTAMP:" . date('Ymd').'T'.date('His') . "\r\n";
	$ical .= "CLASS:PUBLIC\r\n";
	$ical .= "TRANSP:OPAQUE\r\n";
	$ical .= "PRIORITY:5\r\n";		
    $ical .= "SEQUENCE:" . $sequence . "\r\n";
    $ical .= "STATUS:" . $status . "\r\n";
    $ical .= "DTSTART:" . $startTime . "\r\n";
    $ical .= "DTEND:" . $endTime . "\r\n";
	$ical .= "DESCRIPTION:" . str_replace(array("\'", '\"'), array("'", '"'), $description) . "\r\n";
	$ical .= "LOCATION:" . str_replace(array("\'", '\"'), array("'", '"'), $luogo) . "\r\n";
    $ical .= "SUMMARY:" .str_replace(array("\'", '\"'), array("'", '"'), $title) . "\r\n";
	$ical .= "X-ALT-DESC;FMTTYPE=text/html:<html><body style='font-family:calibri; font-size:11pt'>" . str_replace("\\n", "<br>", $description) . "</body></html>\r\n";
    $ical .= "BEGIN:VALARM\r\n";
    $ical .= "TRIGGER:-PT15M\r\n";
    $ical .= "ACTION:DISPLAY\r\n";
    $ical .= "DESCRIPTION:Reminder\r\n";
    $ical .= "END:VALARM\r\n";
    $ical .= "END:VEVENT\r\n";
    $ical .= "END:VCALENDAR\r\n";

    $mail->Subject = $oggetto;

$mail->Body = "<html><body style='font-family:calibri; font-size:11pt'>N.B. Se l'appuntamento non si apre automaticamente fare click sull'allegato.<br><br>" . $body . "</body></html>";
    $mail->Ical = $ical;
    $mail->addStringAttachment($ical, 'event.ics', 'base64', 'text/calendar');
	
    if(!$mail->Send()){die('Errore invio mail per nuovo appuntamento');}`

@Synchro
Copy link
Member

Synchro commented Nov 5, 2019

There were some small changes relating to this recently (#1870), mainly to fix problems in outlook, however, they are pretty sane changes that should not have a major impact. Unfortunately, ical support in email clients is horribly inconsistent, as was discussed in #175. In short, it appears to be impossible to create properly constructed messages that work as the standards say in all email clients - fixing it in one always seems to break it in others.

Can you try using current master branch? There are some issues fixed in there that might make a difference to this.

@Giulo77
Copy link
Author

Giulo77 commented Nov 5, 2019

I've try now and I've same problem with IOS 13. I can accept to insert event by clicking on the ics attachment but I must understand why I can't delete this event.
Android it's ok.

@Giulo77
Copy link
Author

Giulo77 commented Nov 6, 2019

I think what glevin-sugarcrm said in issue 175 is correct: "Outlook and Mac Mail only show their RSVP buttons if you add the ICS content in the way that PHPMailer has implemented it. They will not show RSVP buttons if the ICS file is simply attached."
Then in my example code I've loaded $ical variable with istruction "$mail->Ical = $ical;" is what he defined "in the way that PHPMailer has implemented it"? is it correct?

@Synchro
Copy link
Member

Synchro commented Nov 6, 2019

Consensus seems to be that you need to attach iCal data as both a multipart alternative (what PHPMailer's Ical property does) and as a regular attachment. It's really dumb, but there's not much we can do.

@Giulo77
Copy link
Author

Giulo77 commented Nov 6, 2019

ok, I try to understand what they have changed ... as I said it seems to ignore the defaults and you have to specify all the options. I try to understand what is missing to make the interpretation of the multipart still work.
I try to do as originally, sending an event via outlook and then analyzing the email that arrives

@Giulo77
Copy link
Author

Giulo77 commented Nov 6, 2019

It's incredible!
On Iphone 7 ios 13.2 I've installed 2 account, gmail and microsoft exchange. Then I've sended event to all accounts.
For gmail it's all ok, I clicked on attachment, add event, select gmail account calendar ad immediatly I can see yes/no/maybe buttons.
For MS same steps but after add event I can't do nothing.
Then, is it correct said that if I don't see nothing since I clicked on ics attachment is the apple emal app that have an error of interpretation? Or after adding the event to the calendar at that juncture is the mail server queried that automatically synchronizes my calendar differently?

@Synchro
Copy link
Member

Synchro commented Nov 6, 2019

Unfortunately I really don't know. I rarely use iCal because it so rarely works properly - even a google calendar event sent to gmail doesn't work properly!

@Giulo77
Copy link
Author

Giulo77 commented Nov 6, 2019

ok man, but only a question...this istruction "$mail->addStringAttachment($ical, 'event.ics', 'base64', 'text/calendar');" it's for create the event.ics attachment?

@Synchro
Copy link
Member

Synchro commented Nov 6, 2019

Yes, that looks right.

@Giulo77
Copy link
Author

Giulo77 commented Nov 6, 2019

ok, then if I save it, it's a text file...why I must specified "base64"?
what's the use if I already tell them it's a text/calendar?

@Synchro
Copy link
Member

Synchro commented Nov 6, 2019

base64 is the transfer encoding, not the file type, and it describes how the attachment is represented within the message. Given that ics data is pretty much plain text, other encodings should work too (like quoted-printable), but base64 is safe.

@Giulo77
Copy link
Author

Giulo77 commented Nov 7, 2019

I really can't understand what I have to concentrate on to find the problem!
On my htc android I have configured both gmail and microsoft accounts and the invitations work: in the first case gmail recognizes it automatically, in the second case i click the attachment, I open it I add it to the calendar and I immediately see the yes / no / maybe buttons (strange thing though that if I go to the site office 365 to see the calendar it tells me that I am the organizer when instead I am an invited participant and when I answered yes the organizer received the email in which he says I accepted).
I've done same things on iphone sure to have activated the calendars synchronization, gmail ok, microsoft is inserted only in the local calendar, as if it could not comunicate with exchange server (possible authentication problems?)
On old ipad stopped at ios 10 worse: when i try to save the iics it proposes me all the calendars of all the accounts but those exchanges are not selectable.
So I think we can say that the problem is not which device is used but as the app with which we read the email interprets the attachment ... the file does not change and neither does the recipients so what else can it be?
Obviously we cannot compare it with an outlook submission because we are talking about microsoft products that surely know how to communicate at best and when you receive the e-mail the appointment has certainly already been inserted in the calendar that resides on the relative exchange server.
last tentarivo: I saw that there are "exclusive" microsoft commands regarding the ical so I'm looking for a seeing on the microsoft documentation to see if there is something particular

@Synchro
Copy link
Member

Synchro commented Nov 7, 2019

Welcome to the wonderful world of iCal! 🙃 The specification is in RFC5545, plus some others which extend it. All these clients are supposed to base their behaviour on that spec, but clearly this has not been done consistently, as you're finding. I really don't know what we can do - everyone that generates and sends iCal files runs into the same problems, and making it work in one system will usually stop it working in others.

@Giulo77
Copy link
Author

Giulo77 commented Nov 7, 2019

You're right but the point now is that the same ics file read by my android goes while from ipad (worst situation) nothing to do ... I think I already understand why in the meantime that except for the attachment I see the exchange calendars disabled both the key to the problem.
Sure the problem must be the apple app that interprets the ics attachment, this because everything worked until last month.
Example before I did not even bother to have a progressive SEQUENCE while now not automatically recognizing it interpreted the attachment bad and the second change remaining SEQUENCE: 1 did nothing.
This is an indication that something has changed.
So I think the android app can convert or pass missing information so you can insert it into the exchange calendar, where instead the apple app (also the samsung app on an s10) can't do it automatically.
This is what I have to understand.

@Synchro Synchro closed this as completed Jun 9, 2020
@Giulo77
Copy link
Author

Giulo77 commented Jun 9, 2020 via email

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

2 participants