Hello,
I have below code for my calender invitation.

<?php
$message="

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130901T121000Z
DTEND:20130901T131000Z
DTSTAMP:20110525T075116Z
ORGANIZER;CN=From Name:mailto:from email id
UID:12345678
ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP= TRUE;CN=Sample:emailaddress@testemail.com
DESCRIPTION:Test the first invite
LOCATION: Test Location
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Test the first icalendar invitation
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR";

/*headers*/
$headers = "From: From Name <From Mail>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/calendar; method=REQUEST;\n";
$headers .= '        charset="UTF-8"';
$headers .= "\n";
$headers .= "Content-Transfer-Encoding: 7bit";

/*mail content*/
$subject = "Meeting Subject";
$subject = html_entity_decode($subject, ENT_QUOTES, 'UTF-8');

/*mail send*/
if(mail("emailaddress@testemail.com", $subject, $message, $headers))

{
    echo "Your request has been sent";
}else {
    echo "error";
}
?>

How can I send multiple invitation from this ?
For ex: one invitation for event1 and another for event2
but both from 1 mail only.
Please help me in this.

Please correct me if am wrong in this

Dani AI

Generated

Short answer: a single .ics can contain multiple VEVENTs, but calendar clients handle multi-event meeting requests inconsistently. For reliable RSVP/accept/decline behavior, send one iTIP/REQUEST per event (one invite per event). If sending multiple events in one mail is acceptable (for example, informational calendar import), either include multiple VEVENTs inside one VCALENDAR or attach multiple .ics parts — but ensure the MIME and iCalendar formatting are correct.

Notes specific to and the thread

  • The posted calendar text has a few formatting issues that break many clients: ORGANIZER and ATTENDEE lines must use mailto: URIs (for example, ORGANIZER;CN=Name:mailto:organizer@example.com), and RSVP=TRUE must not contain a space. Each VEVENT must have its own unique UID and DTSTAMP.
  • Member #949455 pointed to the PHP mail docs; that helps with sending mail, but building correct MIME (boundaries, CRLF line endings) and calendar content is the crucial part — using a mail library (PHPMailer/SwiftMailer) avoids many pitfalls.

Minimal example pattern (one VCALENDAR containing two VEVENTs)

BEGIN:VCALENDAR
PRODID:-//Example//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST

BEGIN:VEVENT
UID:evt-20251201-01@example.com
DTSTAMP:20251201T080000Z
DTSTART:20251210T090000Z
DTEND:20251210T100000Z
SUMMARY:Event One
ORGANIZER;CN=Org:mailto:organizer@example.com
ATTENDEE;CN=Attendee;RSVP=TRUE:mailto:attendee@example.com
END:VEVENT

BEGIN:VEVENT
UID:evt-20251202-02@example.com
DTSTAMP:20251202T080000Z
DTSTART:20251211T110000Z
DTEND:20251211T120000Z
SUMMARY:Event Two
ORGANIZER;CN=Org:mailto:organizer@example.com
ATTENDEE;CN=Attendee;RSVP=TRUE:mailto:attendee@example.com
END:VEVENT

END:VCALENDAR

Practical tips

  • Use CRLF (\r\n) for all email headers and iCal lines. Many failures trace to incorrect line endings.
  • Wrap calendar data in a proper MIME part (multipart/alternative or multipart/mixed) with a text/plain fallback and a text/calendar; method=REQUEST; component=VEVENT part (or attach separate .ics files).
  • Test with target clients (Outlook, Apple Calendar, Gmail). If accept/decline tracking is required, send separate meeting requests (one per event) for predictable results.
Member Avatar for Member #949455

How can I send multiple invitation from this ? For ex: one invitation for event1 and another for event2 but both from 1 mail only. Please help me in this.

Use one of these examples:

http://php.net/manual/en/function.mail.php

I am curious why you wrote the code in that format because you are missing some essential info.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.