Title: log_mail_errors does not work in wordpress.com environment
Last modified: April 15, 2024

---

# log_mail_errors does not work in wordpress.com environment

 *  Resolved [rapsli](https://wordpress.org/support/users/rapsli/)
 * (@rapsli)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/log_mail_errors-does-not-work-in-wordpress-com-environment/)
 * On wordpress.com there is a probplem with the e-mail log in the following function:
 *     ```wp-block-code
       function log_mailer_errors( $mailer ) {
   
               if ( $mailer ) {
   
                   $fn = ABSPATH . '/wp-content/mail.log'; // say you've got a mail.log file in your server root
   
                   /* phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen */
   
                   $fp = fopen( $fn, 'a' );
   
                   /* phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fputs */
   
                   fputs( $fp, "Mailer Error: " . print_r( $mailer, true ) . "\n" );
   
                   /* phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose */
   
                   fclose( $fp );
   
               }
   
           }
       ```
   
 * The problem is, that on wordpress.com ABSPATH is not writeable, because the wordpress
   folder is mounted in! So this will then obviously fail, and provide the beloved
   wordpress errormessage.
 * It should be an easy fix to just put the mail.log to a different folder.
 * Here is the stack trace
 * [15-Apr-2024 03:00:08 UTC] PHP Warning: fopen(/wordpress/core/6.5.2//wp-content/
   mail.log): Failed to open stream: Read-only file system in /srv/htdocs/wp-content/
   plugins/classified-listing/app/Controllers/Admin/EmailSettings.php on line 17
   [
   15-Apr-2024 03:00:08 UTC] PHP Fatal error: Uncaught TypeError: fputs(): Argument#
   1 ($stream) must be of type resource, bool given in /srv/htdocs/wp-content/plugins/
   classified-listing/app/Controllers/Admin/EmailSettings.php:19Stack trace: 0 /
   srv/htdocs/wp-content/plugins/classified-listing/app/Controllers/Admin/EmailSettings.
   php(19): fputs(false, ‘Mailer Error: W…’) 1 /wordpress/core/6.5.2/wp-includes/
   class-wp-hook.php(324): Rtcl\Controllers\Admin\EmailSettings->log_mailer_errors(
   Object(WP_Error)) 2 /wordpress/core/6.5.2/wp-includes/class-wp-hook.php(348):
   WP_Hook->apply_filters(”, Array) 3 /wordpress/core/6.5.2/wp-includes/plugin.php(
   517): WP_Hook->do_action(Array) 4 /wordpress/core/6.5.2/wp-includes/pluggable.
   php(581): do_action(‘wp_mail_failed’, Object(WP_Error)) 5 [internal function]:
   wp_mail(Array, ‘[WE-NET ] Veri…’, ‘…’, Array, Array) 6 /srv/htdocs/wp-content/
   plugins/classified-listing/app/Models/RtclEmail.php(763): call_user_func_array(‘
   wp_mail’, Array) 7 /srv/htdocs/wp-content/plugins/classified-listing-pro/app/
   Emails/UserVerifyLinkEmailToUser.php(68): Rtcl\Models\RtclEmail->send() 8 /srv/
   htdocs/wp-content/plugins/classified-listing-pro/app/Models/UserAuthentication.
   php(47): RtclPro\Emails\UserVerifyLinkEmailToUser->trigger(Object(WP_User), ’
   59c6a17f01ca48f…’) 9 /srv/htdocs/wp-content/plugins/classified-listing-pro/app/
   Models/UserAuthentication.php(26): RtclPro\Models\UserAuthentication::send_email(
   Object(WP_User)) 10 /srv/htdocs/wp-content/plugins/classified-listing-pro/app/
   Controllers/AuthController.php(114): RtclPro\Models\UserAuthentication::send_verification_link(
   110) 11 /wordpress/core/6.5.2/wp-includes/class-wp-hook.php(326): RtclPro\Controllers\
   AuthController::user_register(110) 12 /wordpress/core/6.5.2/wp-includes/class-
   wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) 13 /wordpress/core/6.5.2/
   wp-includes/plugin.php(517): WP_Hook->do_action(Array) 14 /wordpress/core/6.5.2/
   wp-includes/user.php(2508): do_action(‘user_register’, 110, Array) 15 /srv/htdocs/
   wp-content/plugins/classified-listing/app/Helpers/Functions.php(3563): wp_insert_user(
   Array) 16 /srv/htdocs/wp-content/plugins/classified-listing/app/Controllers/FormHandler.
   php(304): Rtcl\Helpers\Functions::create_new_user(‘tester2@wundern…’, ‘tester2’,‘
   tester’, Array) 17 /wordpress/core/6.5.2/wp-includes/class-wp-hook.php(324): 
   Rtcl\Controllers\FormHandler::process_registration(”) 18 /wordpress/core/6.5.2/
   wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) 19 /wordpress/
   core/6.5.2/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 20 /wordpress/
   core/6.5.2/wp-settings.php(717): do_action(‘wp_loaded’) 21 /srv/htdocs/wp-config.
   php(100): require_once(‘/wordpress/core…’) 22 /wordpress/core/6.5.2/wp-load.php(
   55): require_once(‘/srv/htdocs/wp-…’) 23 /wordpress/core/6.5.2/wp-blog-header.
   php(13): require_once(‘/wordpress/core…’) 24 /wordpress/core/6.5.2/index.php(
   17): require(‘/wordpress/core…’) 25 {main}
 * thrown in /srv/htdocs/wp-content/plugins/classified-listing/app/Controllers/Admin/
   EmailSettings.php on line 19

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [Muhammad Ali Akbar](https://wordpress.org/support/users/alireyad/)
 * (@alireyad)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/log_mail_errors-does-not-work-in-wordpress-com-environment/#post-17689202)
 * Hi,
   Please, check your wp-config.php file how you define or override it. Could
   you send the file or any screenshot of it?
 * Thank you
 *  Thread Starter [rapsli](https://wordpress.org/support/users/rapsli/)
 * (@rapsli)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/log_mail_errors-does-not-work-in-wordpress-com-environment/#post-17693685)
 * unfortunately it’s not that fancy 🙁 I have just added some comments to your 
   code to disable the logging.
 *  Plugin Support [Muhammad Ali Akbar](https://wordpress.org/support/users/alireyad/)
 * (@alireyad)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/log_mail_errors-does-not-work-in-wordpress-com-environment/#post-17695141)
 * Hi,
   No worries, we fixed it. Hope will get in next update.
 * Thank you
 *  Thread Starter [rapsli](https://wordpress.org/support/users/rapsli/)
 * (@rapsli)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/log_mail_errors-does-not-work-in-wordpress-com-environment/#post-17695182)
 * great. Will look out for it.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘log_mail_errors does not work in wordpress.com environment’ is closed
to new replies.

 * ![](https://ps.w.org/classified-listing/assets/icon-256x256.gif?rev=3004059)
 * [Classified Listing – AI-Powered Classified ads & Business Directory Plugin](https://wordpress.org/plugins/classified-listing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/classified-listing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/classified-listing/)
 * [Active Topics](https://wordpress.org/support/plugin/classified-listing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/classified-listing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/classified-listing/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [rapsli](https://wordpress.org/support/users/rapsli/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/log_mail_errors-does-not-work-in-wordpress-com-environment/#post-17695182)
 * Status: resolved