0

I created a test php file which exists in public_html. I also copied it to the wp-content folder.

All it does is call:

<?php 

wp_mail('myemail@mydomain.com','test','hi');

?>

Neither file actually sends the email when I load it in the browser.

What am I doing wrong??? I read the codex and from what I can see, nothing else is required as arguments.

Thank you for any help!

4

Your test.php file is a standalone script and isn't part f WordPress so it has no access to the WordPress functions.

A simple way to resolve this would be to include wp-load.php at the top of your script, but AFAIK this is not a good approach as you're loading WordPress over again to use just a single function.

In your public_html folder

<?php 

require_once('wp-load.php');

wp_mail('myemail@mydomain.com','test','hi');

?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.