I’m using the Kirby version 3.9.1.
I’ve installed Uniform into site/plugins/uniform successfully.
However, even when I follow the basic examples and put them into templates, controller, and CSS, it doesn’t seem to work. The error message I’m receiving is: “There was an error sending the form: Could not instantiate mail function.”
Can anyone help me with this?
The URL I’m currently testing is as follows:
http://s962295664.onlinehome.us/test
templates/test.php
<form action="<?php echo $page->url() ?>" method="POST">
<input name="email" type="email" value="<?php echo $form->old('email'); ?>">
<textarea name="message"><?php echo $form->old('message'); ?></textarea>
<?php echo csrf_field(); ?>
<?php echo honeypot_field(); ?>
<input type="submit" value="Submit">
</form>
<?php if ($form->success()): ?>
Success!
<?php else: ?>
<?php snippet('uniform/errors', ['form' => $form]); ?>
<?php endif; ?>
controllers/test.php
<?php
use Uniform\Form;
return function ($kirby) {
$form = new Form([
'email' => [
'rules' => ['required', 'email'],
'message' => 'Email is required',
],
'message' => [],
]);
if ($kirby->request()->is('POST')) {
$form->emailAction([
'to' => 'sonahyong@gmail.com',
'from' => 'sonahyong@gmail.com',
])->done();
}
return compact('form');
};