I use this: Plain contactform example for Kirby 2 · GitHub for building a contactform.
Is it possible to add files to the generated mail?
I found no documentation on the appropriate method: kirby Toolkit: https://getkirby.com/docs/toolkit/api#email
I use this: Plain contactform example for Kirby 2 · GitHub for building a contactform.
Is it possible to add files to the generated mail?
I found no documentation on the appropriate method: kirby Toolkit: https://getkirby.com/docs/toolkit/api#email
Because the toolkit email class is “just” a wrapper for the PHP mail function (and other email providers), you should be able to send attachments the same way as using the mail function directly. (Just google PHP mail attachment)
But as I took a look at the source code of the toolkit email class (https://github.com/getkirby/toolkit/blob/master/lib/email.php), there seems to be no way to add custom headers. This would be necessary to set the correct Content-Type and mail boundary.
So I think, you must write your own wrapper for the plain php mail function.
Have you seen this post? Maybe it helps.
You don’t have to use something like PHPMailer but it is much easier (and less error-prone) than implementing everything by yourself. You are not limited to PHPMailer: there are alternatives like Swiftmailer, too. But if you absolutely want to do it yourself, there are examples in the Stack Overflow answers I linked above.
Yes. Thanks. Do you have a complete, working example based on uniform and PHPMailer including the support for attachments?