I have a contact form in this website http://dil33pm.in/contact/ The send button is connected to the file contact-form.php which has this basic test code.
<?php
$to = "dil33pm@gmail.com";
// Email subject and body text
$subject = 'wp_mail function test';
$message = 'This is a test of the wp_mail function: wp_mail is working';
$headers = '';
// Load WP components, no themes
define('WP_USE_THEMES', false);
$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
require_once( $parse_uri[0] . 'wp-load.php' );
// send test message using wp_mail function
try {
$sent_message = wp_mail( $to, $subject, $message, $headers );
}catch (Exception $e) {
error_log('oops: ' . $e->getMessage());
echo 'error failed because '.$e->getMessage();
}
if($sent_message)
{
echo ' <div class="alert alert-confirm">
<h6>'.__("Your message has been sent. Thank You.", 'sr_xone_theme').'</h6>
</div>';
}
else
{
echo ' <div class="alert alert-error">
<h6>'.__("Your message has not been sent", 'sr_xone_theme').'</h6>
</div>';
}
?>
But I am getting error - Your message has not been sent. I tried to use PHP's mail() function, still no good. PHP is not returning any error, I turned on the debugging of PHP to see if there is any.
What could be wrong? I read about setting up SMTP, but I am not sure what is the real problem. My website is hosted in www.axoservers.com
Thank you!