wp_mail() not sending email in multisite subdomain
I have a multisite enabled WordPress configuration. My main domain is like http://www.example.com, with several subdomains like http://test1.example.com, http://test2.example.com, and so on.
I have written a function in my multisite theme's function file to send some notifications to the multisite users.
$headers[] = 'Content-Type: text/html; charset=UTF-8';
wp_mail('[email protected]', 'Test','Test', $headers);
It send the mails as desired when on the main domain, but it does not send any mails when used in subdomain function files.
For example, [email protected]
is a registered user for http://test1.example.com and he submitting some information in his subdomain page http://test1.example.com/information-form. I want to send that information to that user's email.
EDIT: Scenarios:
- I have a form which have some input fields.
- Users fills it and upon submitting, using ajax the values transferred to functions file.
- There is a
add_action('wp_ajax_xxx', 'myFunction');
hook in function page (User is logged in) - In
myFunction
the above mentioned code resides.