I'm trying to get a contact form on a web page to work after the web host stopped supporting the PHP-version it was built for. For some reason I can't get the email to send and I can't for the life of me figure out whats wrong with the code!
Using Chrome to monitor the network traffic I get the error message that is added to the block below.
{success: false, error: "Kunde inte skicka e-postmeddelande"}
("Unable to send email")
Here is the block that send the email:
$to = $form['email']['to'];
$subject = $form['subject'];
$message = get_email_body($subject, $form['heading'], $form['fields'], $form['resources']);
$headers = get_email_headers($to, $form_email);
$sent = @mail($to, $subject, $message, $headers);
if(!$sent)
die(get_form_error_response($form['resources']['failed_to_send_email']));
$success_data = array(
'redirect' => $form['success_redirect']
);
Since I can't find any errors in the code I'm stuck. If anyone can see anything I can't, or maybe point me to where to look next I'd be eternally grateful!