make_ical()
Build the text of an iCalendar (.ics) file for a single event. Pair it with email_attachment() and smtp_email_send() (or the Send Email brick's inline attachment) so recipients can add the event to their calendar with one click.
Syntax
make_ical(params)
Parameters
One associative array:
| Key | Type | Required | Description |
|---|---|---|---|
title |
string | yes | Event title (SUMMARY). |
start |
string | yes | Y-m-d for an all-day event, or Y-m-d H:i:s for a timed one. |
end |
string | no | Same format as start. All-day ends are inclusive (the whole end day is part of the event). |
description |
string | no | Event details. |
location |
string | no | Event location. |
url |
string | no | Link shown on the event. |
timezone |
string | no | IANA timezone the start/end are expressed in (e.g. Europe/Vienna). Default UTC. |
uid |
string | no | Stable event id — reuse the same uid to update an event a recipient already imported. Auto-generated when omitted. |
method |
string | no | PUBLISH (default), REQUEST (invitation), or CANCEL. |
organizer |
string/array | no | "Name <email>" or ["name" => ..., "email" => ...]. |
attendees |
string/array | no | Comma-separated string or array of organizer-style entries. |
calname |
string | no | Calendar display name. |
Timed values are converted to UTC in the output, so they land correctly in every recipient's timezone.
Returns
The .ics text (a string). Throws on a missing title/start, unparseable date, unknown timezone, or invalid method.
Example
$ics = make_ical([
"title" => "Kickoff: " . $record["title"],
"start" => "2026-08-01 09:00:00",
"end" => "2026-08-01 10:00:00",
"timezone" => "Europe/Vienna",
"location" => "HQ, Room 1",
"method" => "REQUEST",
"organizer" => "Sales Team <sales@example.com>",
"attendees" => $record["email"],
]);
smtp_email_send("company_smtp", [
"to" => $record["email"],
"subject" => "Invitation: Kickoff",
"html" => "<p>Please find the calendar invite attached.</p>",
"attachments" => [email_attachment("invite.ics", $ics, "text/calendar")],
]);
Example output
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//InfoLobby//Feed//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
UID:il-688b2f1e4a9d07.12345678@infolobby.com
DTSTAMP:20260716T120000Z
DTSTART:20260801T070000Z
DTEND:20260801T080000Z
SUMMARY:Kickoff: ACME
LOCATION:HQ\, Room 1
ORGANIZER;CN=Sales Team:mailto:sales@example.com
ATTENDEE;RSVP=TRUE:mailto:customer@example.org
END:VEVENT
END:VCALENDAR