forked from PHPMailer/PHPMailer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cancel ICS file corrupted on Office 365 PHPMailer#1780 (PHPMailer#1842)
* Cancel ICS file corrupted on Office 365 PHPMailer#1780
- Loading branch information
Showing
2 changed files
with
166 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2686,6 +2686,131 @@ public function testOAuth() | |
$this->assertNull($subject); | ||
$this->assertInstanceOf(OAuth::class, $PHPMailer->getOAuth()); | ||
} | ||
|
||
/** | ||
* Test ICal method | ||
*/ | ||
public function testICalMethod() | ||
{ | ||
$this->Mail->Subject .= ': ICal method'; | ||
$this->Mail->Body = '<h3>ICal method test.</h3>'; | ||
$this->Mail->AltBody = 'ICal method test.'; | ||
$this->Mail->Ical = 'BEGIN:VCALENDAR' | ||
. "\r\nVERSION:2.0" | ||
. "\r\nPRODID:-//PHPMailer//PHPMailer Calendar Plugin 1.0//EN" | ||
. "\r\nMETHOD:CANCEL" | ||
. "\r\nCALSCALE:GREGORIAN" | ||
. "\r\nX-MICROSOFT-CALSCALE:GREGORIAN" | ||
. "\r\nBEGIN:VEVENT" | ||
. "\r\nUID:201909250755-42825@test" | ||
. "\r\nDTSTART;20190930T080000Z" | ||
. "\r\nSEQUENCE:2" | ||
. "\r\nTRANSP:OPAQUE" | ||
. "\r\nSTATUS:CONFIRMED" | ||
. "\r\nDTEND:20190930T084500Z" | ||
. "\r\nLOCATION:[London] London Eye" | ||
. "\r\nSUMMARY:Test ICal method" | ||
. "\r\nATTENDEE;CN=Attendee, Test;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=" | ||
. "\r\n TRUE:MAILTO:[email protected]" | ||
. "\r\nCLASS:PUBLIC" | ||
. "\r\nDESCRIPTION:Some plain text" | ||
. "\r\nORGANIZER;CN=\"Example, Test\":MAILTO:[email protected]" | ||
. "\r\nDTSTAMP:20190925T075546Z" | ||
. "\r\nCREATED:20190925T075709Z" | ||
. "\r\nLAST-MODIFIED:20190925T075546Z" | ||
. "\r\nEND:VEVENT" | ||
. "\r\nEND:VCALENDAR"; | ||
$this->buildBody(); | ||
$this->Mail->preSend(); | ||
$this->assertRegExp( | ||
'/Content-Type: text\/calendar; method=CANCEL;/', | ||
$this->Mail->getSentMIMEMessage(), | ||
'Wrong ICal method in Content-Type header' | ||
); | ||
} | ||
|
||
/** | ||
* Test ICal missing method to use default (REQUEST) | ||
*/ | ||
public function testICalInvalidMethod() | ||
{ | ||
$this->Mail->Subject .= ': ICal method'; | ||
$this->Mail->Body = '<h3>ICal method test.</h3>'; | ||
$this->Mail->AltBody = 'ICal method test.'; | ||
$this->Mail->Ical = 'BEGIN:VCALENDAR' | ||
. "\r\nVERSION:2.0" | ||
. "\r\nPRODID:-//PHPMailer//PHPMailer Calendar Plugin 1.0//EN" | ||
. "\r\nMETHOD:INVALID" | ||
. "\r\nCALSCALE:GREGORIAN" | ||
. "\r\nX-MICROSOFT-CALSCALE:GREGORIAN" | ||
. "\r\nBEGIN:VEVENT" | ||
. "\r\nUID:201909250755-42825@test" | ||
. "\r\nDTSTART;20190930T080000Z" | ||
. "\r\nSEQUENCE:2" | ||
. "\r\nTRANSP:OPAQUE" | ||
. "\r\nSTATUS:CONFIRMED" | ||
. "\r\nDTEND:20190930T084500Z" | ||
. "\r\nLOCATION:[London] London Eye" | ||
. "\r\nSUMMARY:Test ICal method" | ||
. "\r\nATTENDEE;CN=Attendee, Test;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=" | ||
. "\r\n TRUE:MAILTO:[email protected]" | ||
. "\r\nCLASS:PUBLIC" | ||
. "\r\nDESCRIPTION:Some plain text" | ||
. "\r\nORGANIZER;CN=\"Example, Test\":MAILTO:[email protected]" | ||
. "\r\nDTSTAMP:20190925T075546Z" | ||
. "\r\nCREATED:20190925T075709Z" | ||
. "\r\nLAST-MODIFIED:20190925T075546Z" | ||
. "\r\nEND:VEVENT" | ||
. "\r\nEND:VCALENDAR"; | ||
$this->buildBody(); | ||
$this->Mail->preSend(); | ||
$this->assertRegExp( | ||
'/Content-Type: text\/calendar; method=REQUEST;/', | ||
$this->Mail->getSentMIMEMessage(), | ||
'Wrong ICal method in Content-Type header' | ||
); | ||
} | ||
|
||
/** | ||
* Test ICal invalid method to use default (REQUEST) | ||
*/ | ||
public function testICalDefaultMethod() | ||
{ | ||
$this->Mail->Subject .= ': ICal method'; | ||
$this->Mail->Body = '<h3>ICal method test.</h3>'; | ||
$this->Mail->AltBody = 'ICal method test.'; | ||
$this->Mail->Ical = 'BEGIN:VCALENDAR' | ||
. "\r\nVERSION:2.0" | ||
. "\r\nPRODID:-//PHPMailer//PHPMailer Calendar Plugin 1.0//EN" | ||
. "\r\nCALSCALE:GREGORIAN" | ||
. "\r\nX-MICROSOFT-CALSCALE:GREGORIAN" | ||
. "\r\nBEGIN:VEVENT" | ||
. "\r\nUID:201909250755-42825@test" | ||
. "\r\nDTSTART;20190930T080000Z" | ||
. "\r\nSEQUENCE:2" | ||
. "\r\nTRANSP:OPAQUE" | ||
. "\r\nSTATUS:CONFIRMED" | ||
. "\r\nDTEND:20190930T084500Z" | ||
. "\r\nLOCATION:[London] London Eye" | ||
. "\r\nSUMMARY:Test ICal method" | ||
. "\r\nATTENDEE;CN=Attendee, Test;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=" | ||
. "\r\n TRUE:MAILTO:[email protected]" | ||
. "\r\nCLASS:PUBLIC" | ||
. "\r\nDESCRIPTION:Some plain text" | ||
. "\r\nORGANIZER;CN=\"Example, Test\":MAILTO:[email protected]" | ||
. "\r\nDTSTAMP:20190925T075546Z" | ||
. "\r\nCREATED:20190925T075709Z" | ||
. "\r\nLAST-MODIFIED:20190925T075546Z" | ||
. "\r\nEND:VEVENT" | ||
. "\r\nEND:VCALENDAR"; | ||
$this->buildBody(); | ||
$this->Mail->preSend(); | ||
$this->assertRegExp( | ||
'/Content-Type: text\/calendar; method=REQUEST;/', | ||
$this->Mail->getSentMIMEMessage(), | ||
'Wrong ICal method in Content-Type header' | ||
); | ||
} | ||
} | ||
/* | ||
* This is a sample form for setting appropriate test values through a browser | ||
|