php - wp_mail() or mail() not working in Wordpress contact form -
this question has answer here:
i have contact form in website http://dil33pm.in/contact/ send button connected file contact-form.php has basic test code.
<?php $to = "dil33pm@gmail.com"; // email subject , body text $subject = 'wp_mail function test'; $message = 'this test of wp_mail function: wp_mail 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 getting error - message has not been sent. tried use php's mail() function, still no good. php not returning error, turned on debugging of php see if there any.
what wrong? read setting smtp, not sure real problem. website hosted in www.axoservers.com
thank you!
this issue varies host host. recommend using plugin: https://wordpress.org/plugins/easy-wp-smtp/
Comments
Post a Comment