I have seen numerous discussions and queries on subjects which varies from simple plugins to fully complex scripts, all being blamed by people that they didn’t work but they are unable to receive an expected email.
And most of the time it has to do with the webhost. Several webhosts disable the mail sending capabilities on their shared hosting account so as to avoid spam being send from their server.
But before you ran into your webhost blaming for the cause, I would say how about we check whether the issue is really the webhost?
Just create a simple php file with the following content and upload it to the root of your hosting account and access it in browser as example.com/testfile.php
<?php // Your email address $email = "firstname.lastname@example.org"; // The subject $subject = "testing mail sending capabilities"; // The message $message = "test"; if ( mail($email, $subject, $message, "From: $email") ) echo "The email has been sent!"; else echo "Error sending email!"; ?>
Replace the email address with your own email address on line 4.
This code snippet tries to send a mail to the email address specified on line 4 and if the mail was successfully sent, you will see the message “The email has been sent!” else you will see the message “Error sending email!”.
If you are using WordPress, I would suggest using this snippet which checks for both PHP’s mail() function and WordPress’s wp_mail() function as wp_mail function is pluggable and may be some plugin has plugged it and only may be that is failing and nothing is wrong at the web host side. But make sure that you place the file in WordPress root and not domain root as it will load the WordPress environment and then try to send mail by wp_mail().
<?php // Your email address $email = "email@example.com"; // The subject $subject = "testing mail sending capabilities"; // The message $message = "test"; // load WP now require('wp-load.php'); if ( mail($email, $subject, 'mail: ' . $message, "From: $email") ) echo "The email has been sent using the PHP's mail() function."; if ( wp_mail($email, $subject, 'wp_mail: ' . $message, "From: $email") ) echo "The email has been sent using the wp_mail() function.";
If you need any help, then feel free to leave a comment here and I will try to help.
Alternatively, you can also hire me.