Regarding logging, I did mention them earlier. To recap: I entered this in the site’s wp-config.php file:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
I got no indication of any problem in debug.log when trying to send a test message.
I then ran this in the site as a webpage:
<?php
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
$to = 'me@mydomain.com';
$subject = 'Test Mail using WordPress from MyServer';
$message = 'Hello, this is a test email using the PHP mail() function in the root of a WordPress website on MyServer.';
$headers = 'From: webmaster@thesite.com' . "\r\n" .
'Reply-To: me@mydomain.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if(wp_mail($to, $subject, $message, $headers)) {
echo "Email sent successfully";
} else {
echo "Email sending failed";
}
?>
To which it simply indicated “Email sending failed” in my browser.
I did this test (as root) as well:
echo "Subject: Test Mail" | /usr/sbin/sendmail -v myemail@mydomain.com
Which worked and was received through my email.
In all of my failed test attempts I didn’t see any indications of an error or even an attempt to send anything from the web space.
The /var/log/mail.log showed my successful attempt using /usr/sbin/sendmail above and the usual ongoing barrage of attempts by spammers and hackers and bots but never gave me any indications of issues with all of my failed attempts using a form on the website or the PHP page indicated above.
The /home/username/logs/php_log never gave me any indications of issues with all of my failed attempts using a form on the website or the PHP page indicated above.
I checked the mail queue and it was empty.
Hope that clarifies better. I originally indicated I believe that PHP is not handing off the emails to the correct place but I’m unable to figure out where that is happening. Especially with no log output for guidance.