Skip to content

Feature/ics rework/mime - #1657

Open
lucs7 wants to merge 1 commit into
LibreBooking:developfrom
lucs7:feature/ics-rework/mime
Open

Feature/ics rework/mime#1657
lucs7 wants to merge 1 commit into
LibreBooking:developfrom
lucs7:feature/ics-rework/mime

Conversation

@lucs7

@lucs7 lucs7 commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

This pull request enhances the email attachment handling system by allowing MIME types to be specified for string attachments, ensuring correct content types are used when sending emails.

Depends on #1656

@lucs7
lucs7 force-pushed the feature/ics-rework/mime branch 2 times, most recently from dba2310 to 8d04d13 Compare August 22, 2026 11:40
@lucs7
lucs7 marked this pull request as ready for review August 26, 2026 08:15
Copilot AI lite review requested due to automatic review settings August 26, 2026 08:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends LibreBooking’s email attachment pipeline so IEmailMessage string attachments can optionally provide an explicit MIME Content-Type, allowing reservation .ics attachments to be sent with text/calendar; ...; method=REQUEST instead of relying on filename-based detection. It also incorporates the attachment-leak fix from the dependent PR (#1656) by clearing PHPMailer attachments before each send.

Changes:

  • Add optional $mimeType support to IEmailMessage::AddStringAttachment(...) and propagate it through EmailMessage + EmailService into PHPMailer’s addStringAttachment(...).
  • Update reservation ICS generation to set an explicit calendar MIME type.
  • Add PHPUnit coverage for EmailService attachment clearing and MIME passthrough.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/lib/Email/EmailServiceTest.php Adds unit tests for clearing attachments per send and passing MIME type into PHPMailer.
tests/fakes/FakeEmailMessage.php Introduces a minimal IEmailMessage fake that supports string attachments + optional MIME type.
tests/fakes/TestReservationEmailMessage.php Adds a reservation-email fake intended to expose ICS attachment generation for testing.
tests/fakes/namespace.php Registers new fakes in the global test bootstrap.
lib/Email/IEmailMessage.php Extends the interface to accept/return attachment MIME type.
lib/Email/EmailMessage.php Stores and exposes the optional attachment MIME type.
lib/Email/EmailService.php Clears attachments before each send and forwards MIME type to PHPMailer.
lib/Email/Messages/ReservationEmailMessage.php Sets the ICS attachment MIME type to text/calendar; charset=UTF-8; method=REQUEST.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/fakes/namespace.php Outdated
Comment on lines +222 to +226
$this->AddStringAttachment(
$icsContents,
'reservation.ics',
'text/calendar; charset=UTF-8; method=REQUEST'
);
@lucs7
lucs7 force-pushed the feature/ics-rework/mime branch from 8d04d13 to e3ac689 Compare August 26, 2026 19:44
Added mime-type to ics attachment to improve RFC 5546 compliance
and client event recognition. Added mime-type specific tests.
@lucs7
lucs7 force-pushed the feature/ics-rework/mime branch from e3ac689 to 1e62cc7 Compare August 28, 2026 18:54
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

Successfully merging this pull request may close these issues.

3 participants