I use the plugin Uniform to send emails with a html template. That works
I want to add an .ics (calendar) file attachment to the email. This file should be filled with some fields from the form. I want to use the ācontent representationā functionality. That - I could not get to work
What I have
I have made an agenda.ics.php file in the templates folder. I made a page in the content/ folder that uses the agenda template. I can open the .ics file in my browser with url: kirby.test/calendar_event.ics - it will download the (static) ICS file.
But I havenāt succeeded in attaching any file to an email.
I have some questions
- What is the syntax for the āattachmentsā => āā when I want to add a dynamic file? See code snippet below.
- Is ācontent representationā the best way to make a dynamic file available that can be attached?
- How can I make the attachment file dynamic, so how can I add 3 fields from the form into the .ics file?
I have read many forum posts about attachments, and tried a lot of probable syntaxes, but I have not found an answer yet.
if ($kirby->request()->is('POST')) {
$form->emailAction([
'to' => 'somebody@planet.nl',
'from' => 'info@example2.com',
'template' => 'success',
'attachments' => $_FILES['http://kirby.test/calendar_event.ics'],
])->done();
}
Thanks!
RenƩ