Sending mail through a plugin using wp_mail
-
Hey guys,
I run several websites on one server and for some reason I cant seem to use wp_mail to send emails through my main domain. Every other domain and new domains I create work but not the main domain. Ive tried using several plugins including wp-mail-smtp but unfortunately I cant get my main domain to send mail using the wp_mail function. I can use the mail() function but this isnt ideal and I heard it can be easily hacked. I wrote a script to test the wp_mail function:
<?php /** * This file can be used to validate that the WordPress wp_mail() function is working. * To use, change the email address in $to below, save, and upload to your WP root. * Then browse to the file in your browser. */ // Set $to as the email you want to send the test to $to = "support@XXXXX.com.au"; // No need to make changes below this line // Email subject and body text $subject = 'wp_mail function test'; $message = 'This is a test of the wp_mail function: wp_mail is working'; $headers = 'no-reply@xxxx.com.au'; // Load WP components, no themes define('WP_USE_THEMES', false); require('wp-load.php'); // send test message using wp_mail function $sent_message = wp_mail( $to, $subject, $message, $headers ); //display message based on the result. if ( $sent_message ) { // the message was sent... echo 'The test message was sent. Check your email inbox.'; } else { // the message was not sent... echo 'The message was not sent!'; }
This function seems to work with my sub-domains but not with my main domain. The error message just says message not sent. Is there a way I can test wp_mail better? Maybe get a more meaningful error message that can help me pin-point the problem code? My hosting provider insist its a wordpress issue.
Kind Regards
UPDATE:
So i’ve reinstalled my core wordpress files and the problem is still there.
- The topic ‘Sending mail through a plugin using wp_mail’ is closed to new replies.