I need some direction on the following:
I developed a contact form using AngularJS and PHP. I am hosting the website on GoDaddy. When I access the website on a computer and send a message from the contact form to the specified email address, it works fine; I receive the email. However, if I access the website from a mobile device and use the contact form to send an email, the email is never received. Below is my code.
<?php
$contactFormData = file_get_contents( 'php://input' );
$data = json_decode($contactFormData);
if ($data) {
$sendername = $data->contactname;
$sendersubject = $data->subject;
$senderemail = $data->email;
$message = $data->message;
if ( $sendername != '') {
$mailTo = 'contact@me.com';
$subject = 'New contact form submission';
$body .= 'From: ' . $sendername . "\n";
$body .= 'Subject: ' . $sendersubject . "\n";
$body .= 'Email: ' . $senderemail . "\n";
$body .= "Message:\n" . $message . "\n\n";
$sent = mail( $mailTo, $subject, $body );
}
}
?>