Download the PHP package cosimomeli/swiftmailer-calendar without Composer
On this page you can find all versions of the php package cosimomeli/swiftmailer-calendar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cosimomeli/swiftmailer-calendar
More information about cosimomeli/swiftmailer-calendar
Files in cosimomeli/swiftmailer-calendar
Package swiftmailer-calendar
Short Description Swiftmailer attachment class to send embedded iCal
License MIT
Homepage https://github.com/cosimomeli/swiftmailer-calendar
Informations about the package swiftmailer-calendar
swiftmailer-calendar
A simple class to embed calendar events to emails.
Installation
You can install this package by using Composer, running this command:
Link to Packagist: https://packagist.org/packages/cosimomeli/swiftmailer-calendar
Usage
Basic Usage
1. Create an iCal object
You can make it by string concatenation or you can use one of the many libraries to build it. I suggest markuspoerschke/iCal: https://github.com/markuspoerschke/iCal
The result will be something like this:
More information about iCalendar specifications here: http://www.kanzaki.com/docs/ical/
Just be sure to set the METHOD field as PUBLISH or REQUEST, and set at least the recipient of the email as ATTENDEE.
2. Create the Swift_Calendar object
The method must be the same as the one you set in the iCal.
3. Attach it to the message
You can add more different MIME parts to the message. I tested it with text/plan + text/html and with a normal attachment too.
4. Send it
Notes
Mail clients handle the embedded calendar in different ways. Here are some of my personal experiences:
-
Outlook: Uses the email body as event description and the email subject as event title. Calendars with PUBLISH method are not listed with emails, but only showed as toast in the web interface (so my advice is to NOT use this method).
- Gmail: Uses the fields DESCRIPTION and SUMMARY as description and title of the event (just as it should be)
Feel free to ask any question and to give any suggestion for improvements.