I am writing a plugin that opens up a form to invite people to a website by email and want to use wp_mail()
.
Whenever I use the wp_mail()
function in any file in my plugin folder I always end up with:
PHP Fatal error: Call to undefined function wp_mail()
The code segment in question is:
function send_email() {
$subject="test";
$message="this is a test from send invitation";
$to = 'navanitachora@gmail.com';
wp_mail($to, $subject, $message);
}
I am at my wits end as to why this should be happening when so many plugins use wp_mail()
.
Thanks in advance.