Hello, few days ago I changed the hosting for my Kirby page, from DoDaddy to Neubox, and my mailer controller stopped working. This is the message I receive when I try to use the contact form in my page:
“escapeshellcmd() has been disabled for security reasons”
return function($kirby, $page) {
if ($kirby->request()->is('POST') && get('submit')) {
// initialize variables
$alerts = null;
// check the honeypot
if (empty(get('website')) === false) {
go($page->url());
exit;
}
// get the data and validate the other form fields
$data = [
'name' => get('name'),
'email' => get('email'),
'message' => get('message')
];
$rules = [
'name' => ['required', 'min' => 3],
'email' => ['required', 'email']
];
$messages = [
'name' => 'Por favor escriba un nombre válido.',
'email' => 'Por favor escriba un correo válido.'
];
// some of the data is invalid
if ($invalid = invalid($data, $rules, $messages)) {
$alerts = $invalid;
}
// the data is fine, let's send the email
if (empty($alerts)) {
try {
$kirby->email([
'template' => 'email',
'from' => 'hey@goldensub.com',
'to' => 'jhserna.b@gmail.com',
'subject' => 'Contacto',
'data' => [
'name' => esc($data['name']),
'email' => esc($data['email']),
'message' => esc($data['message'])
]
]);
} catch (Exception $error) {
$alerts[] = $error->getMessage();
}
// no exception occurred, let's send a success message
if (empty($alerts) === true) {
// store reference and name in the session for use on the success page
$kirby->session()->set([
'name' => esc($data['name'])
]);
// redirect to the success page
go('success');
}
}
}
// return data to template
return [
'alerts' => $alerts ?? null,
'data' => $data ?? false,
];
};