wp_mail is undefined

You may call the function too early. You have to wait until the action 'plugins_loaded' fires.

wp_mail() is defined in wp-includes/pluggable.php.
pluggable.php is loaded in wp-settings.php after the plugins are loaded but before 'plugins_loaded' is called.

See this answer for an example.

Leave a Comment