Dave Rottino
Dave Rottino

Reputation: 1047

Dynamically create an .ics file and send as an e-mail attachment

So I have this form and the client is inquiring about sending an .ics file with the information from the form. This would be dynamically created every time and sent as an attachment in a dynamically created e-mail.

So my question is twofold. One, can you create an ICS file on the fly and two, can you send it as an attachment?

It's a PHP 5.x.x environment by the way.

Upvotes: 2

Views: 6095

Answers (1)

Marc B
Marc B

Reputation: 360842

ICS files are just plaintext files, so it's trivial to generate one with PHP: http://en.wikipedia.org/wiki/ICalendar

Once you've generated it, you can trivially do mail attachments with PHPMailer and Swiftmailer. Haven't used swiftmailer, but I do know PHPMailer has a function to create attachments from a variable, not a file.

Upvotes: 6

Related Questions