incorrect “wp_mail” function location
-
Hi,
The plugin shows the following message:
WP Mail SMTP has detected incorrect “wp_mail” function location. Usually, this means that emails will not be sent successfully!
What does it mean and what do I have to do to fix it?
-
Hi @belenberrueta,
as discussed in previous messages, this admin notice is not causing any email sending issues. It’s just checking if the WordPress core function
wp_mail
has a different file path than expected.It is currently showing up for you, because we have a bug for sites hosted on Windows servers. This will be fixed in the next version. And if you want, you can disable the notice with the code snippet mentioned in my previous messages.
Please read this blog post if you want to know how to add custom PHP code to your WP site.
Take care!
Thanks Gregor!
But this error appeared only in the sites I updated the plugin…in the older versions the mails are still working.
When testing the email, the following message appears:
“SMTP ERROR: Failed to connect to server (0)SMTP Error: Could not connect to SMTP host.But the curious thing is that the email and server information are OK.
How can I solve it?
Thanks again!!!
Hi @belenberrueta,
if you have an actual email sending problem, please open a new support ticket here. We will help you out with your email sending issue in that separate thread. When you are opening a new support ticket, please provide as much details as possible (without sharing any personal information – this is a public forum), so we can help you out as fast as possible.
The admin notice that is discussed in this thread was introduced in our latest version, that’s why you don’t see it on other sites that you didn’t update. Or you might not be using Windows as your hosting platform on those sites.
Take care!
Hey everyone,
we just released a new version: v3.5.2, which also contains the fix for the “incorrect
wp_mail
function location” notice being displayed on Windows servers.Please update to the latest version and remove the custom code referenced here, if you added it to your site.
Thank you for your patience and understanding.
Have a nice day!
I’m having the same issue:
WP Mail SMTP has detected incorrect “wp_mail” function location. Usually, this means that emails will not be sent successfully!
Current function path: /wp-includes/pluggable.php:182
Wordpress 6.0.2
Plugin version: 3.5.2Hi @huckster,
could you please let me know the whole error message you get, with the full file path?
Are you experiencing this issue locally or on your web hosting server? Is it a Windows or Linux server?
Could you also please help us and check the values of these PHP and WP constants on your site:
– DIRECTORY_SEPARATOR
– ABSPATH
– WPINCTake care!
Hi Gregor – thanks for the reply – It’s a Linux server, PHP v7.4.19 – it’s a hosted solution.
I get this info when I open the plugin page:
“WP Mail SMTP has detected incorrect “wp_mail” function location. Usually, this means that emails will not be sent successfully!Current function path: /wp-includes/pluggable.php:182″
Also – this error appeared when I upgraded the WordPress from 5.8.x to 6.0.x.
How can I check these constants?
Thanks!
Hi @huckster,
it’s strange that the path does not include a full path, just the ending.
You can get the information about the ABSPATH constant in Tools > Site Health > Info (tab) > WordPress Constants (section).
For the other two constants, you can contact your hosting support.
Take care!
ABSPATH //
WP_HOME Undefined
WP_SITEURL Undefined
WP_CONTENT_DIR //wp-content
WP_PLUGIN_DIR //wp-content/pluginsHi @huckster,
Hmm, this looks strange. I think the issue is a specific hosting setup. It’s causing issues, when we try to compare the paths for the wp_mail function location.
Your emails are sending just OK, right?
I think for your case it’s best to ignore this admin notice and if you want to remove it, you can use this code snippet:
add_filter( 'wp_mail_smtp_core_wp_mail_function_incorrect_location_notice', '__return_false' );
You can read here on how to add PHP code snippets to your WP site.
Have a nice day!
Nooo that’s the problem , the mails are not being sent now 🙁
Sorry! I’ve just checked – it sends the email OK!
I’m just chiming in that I’m seeing this error on my server as well.
I’m on a managed WP host (Pagely) and they have what may be a bit of a non-traditional setup.
Mail *is* working on my server I just have the notice on the admin panel.
Current function path: /wordpress-versions/6.0.2/wp-includes/pluggable.php:182
Our actual site is a different path and WP core files are symlinked into the site’s hosted directory.
The actual ABSPATH is like this:
/data/{server_id}/home/{user_name}/sites/{domain}
Hi @thomasplevy,
thank you for this information.
Our check expects the full path of the file and that’s why it’s showing up this admin notice.
So, it’s a false positive, just as for the user above (huckster). I would suggest hiding the admin notice with the code snippet mentioned in this message.
Thank you and have a nice day!
Noted and taken care of, thanks… But I would love to emphasize that the practice symlinking WP core files in this manner isn’t disallowed or frowned upon and it’s common for managed WP hosts to do this to prevent users from breaking their own site…
I’m sure you’re working to try to help users know when they’ve accidentally broken their site by moving core files or overwriting this pluggable function (or when another plugin has done so) but… in my case (and I’m sure the case of other folks on managed hosts) we’re not doing anything wrong and what’s done is out of our control.
Just my unsolicited thoughts on the matter
- The topic ‘incorrect “wp_mail” function location’ is closed to new replies.