Title: WP Statistics emails failed
Last modified: December 12, 2022

---

# WP Statistics emails failed

 *  Resolved [pinetribewcf](https://wordpress.org/support/users/pinetribewcf/)
 * (@pinetribewcf)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/)
 * Hi,
 * Thank you for your plugin. It’s amazing. But I have an issue with it. So I’ll
   explain the problem:
    1. I don’t get any emails with statistics (reports) (I 
   added all shortcodes in settings). 2. Everything worked fine until (to my mind)
   Dec 06, 2022. It was the last report. 3. I tried to solve the issue: – installed
   WP Crontrol; – I found hooks which were not executed: wp_statistics_report_hook,
   wp_statistics_add_visit_hook , wp_statistics_referrerspam_hook . I tried to execute
   them by myself but it doesn’t work. I deleted them too. The same issue. – deactivated
   and reinstalled WP Statistics and deleted previous crons – the same issue. 4.
   To my mind this issue was discovered after nearest plugin’s update.
 * What can I do else?
    -  This topic was modified 3 years, 4 months ago by [pinetribewcf](https://wordpress.org/support/users/pinetribewcf/).
    -  This topic was modified 3 years, 4 months ago by [pinetribewcf](https://wordpress.org/support/users/pinetribewcf/).

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

 *  Plugin Author [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/)
 * (@mostafas1990)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16285349)
 * Hi,
 * I appreciate your detailed explanation of the issue. The send email functionality
   must be tested in advance, do you use any SMTP plugins?
 * For debugging and see the error of the mail, you can use this hook in **functions.
   php** in your theme
 *     ```
       add_action('wp_mail_failed', function (\WP_Error $error) {
           file_put_contents('log-mail', print_r($error->get_error_message(), 1));
       });
       ```
   
 * Also, don’t forget to check the WP Statistics log file, it’s in **wp-content/
   uploads/wp-statistics/debug.log**
 *  Thread Starter [pinetribewcf](https://wordpress.org/support/users/pinetribewcf/)
 * (@pinetribewcf)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16286810)
 * My answers:
    1. I don’t have any installed SMTP plugins. 2. Added your code. 
   3. I checked WP Statistics log file in wp-content/uploads/wp-statistics/debug.
   log. Here it is:
 *     ```
       2022-11-29 06:07:51: The address 104.20.138.65 is not in the database.
       2022-12-12 05:35:15: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:44:44: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:46:07: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:47:52: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:48:58: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:49:13: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:51:59: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:53:19: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 06:06:52: Duplicate entry '2022-12-13' for key 'unique_date'
       ```
   
 *  Plugin Author [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/)
 * (@mostafas1990)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16288543)
 * Thank you for replying, can you please also this log file? log-mail
 * Should be on the root directory.
 *  Thread Starter [pinetribewcf](https://wordpress.org/support/users/pinetribewcf/)
 * (@pinetribewcf)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16288591)
 * Sorry, I didn’t find it.
 *  Plugin Author [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/)
 * (@mostafas1990)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16292268)
 * Let’s change to use our logger functionality to see the error.
 *     ```
       add_action('wp_mail_failed', function ($error) {
           \WP_Statistics::log($error->get_error_message());
       });
       ```
   
 * Then, try to run the WP Statistics cron manually and check the log **wp-content/
   uploads/wp-statistics/debug.log**
 *  Thread Starter [pinetribewcf](https://wordpress.org/support/users/pinetribewcf/)
 * (@pinetribewcf)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16293712)
 * Just changed logger functionality, ran cron manually – nothing changed. Here 
   it is from debug.log:
 *     ```
       2022-11-29 06:07:51: The address 104.20.138.65 is not in the database.
       2022-12-12 05:35:15: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:44:44: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:46:07: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:47:52: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:48:58: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:49:13: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:51:59: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 05:53:19: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-12 06:06:52: Duplicate entry '2022-12-13' for key 'unique_date'
       2022-12-14 06:08:29: Duplicate entry '2022-12-15' for key 'unique_date'
       2022-12-15 05:17:00: Duplicate entry '2022-12-16' for key 'unique_date'
       2022-12-15 05:17:02: Duplicate entry '2022-12-16' for key 'unique_date'
       ```
   
 * And here are WP_Statistics crons:
 *     ```
       wp_statistics_report_hook
       Изменить | Запустить сейчас | Pause | Удалить
       Отсутствует	2022-12-16 20:16:47
       23 часа 59 минут	 Отсутствует	Каждый день
       Выбрать эту строку	wp_statistics_add_visit_hook
       Изменить | Запустить сейчас | Pause | Удалить
       Отсутствует	2022-12-16 20:17:00
       23 часа 59 минут	 Отсутствует	Каждый день
       Выбрать эту строку	wp_statistics_referrerspam_hook
       Изменить | Запустить сейчас | Pause | Удалить
       Отсутствует	2022-12-22 20:17:10
       6 дней 23 часа	 Отсутствует	Один раз в неделю
       ```
   
 * It’s in russian, but here is interesting message in the field “Action” – “Отсутствует”
   which means that “Absent” (no action). It’s look like that it doesn’t do anything.
 *  Plugin Author [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/)
 * (@mostafas1990)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16301860)
 * Weird indeed, can you please make sure your server can’t send the email? you 
   can send a test email at [https://wordpress.org/plugins/wp-mail-smtp/](https://wordpress.org/plugins/wp-mail-smtp/)
 * Also, this plugin might help us somehow [https://wordpress.org/plugins/wp-mail-logging/](https://wordpress.org/plugins/wp-mail-logging/)
 *  Thread Starter [pinetribewcf](https://wordpress.org/support/users/pinetribewcf/)
 * (@pinetribewcf)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16603041)
 * I did it after 3 months. So the main problem that my hosting has some limitations
   with emails and I couldn’t get any statistics. But it’s interesting that WP Statistics
   was sending successfully email after reset.
 * So how to solve this problem: I installed plugin “**[WP SMTP](https://ru.wordpress.org/plugins/wp-smtp/)**”
   and now it works.
 * Thank you for support!!!

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

The topic ‘WP Statistics emails failed’ is closed to new replies.

 * ![](https://ps.w.org/wp-statistics/assets/icon.svg?rev=3081064)
 * [WP Statistics – Simple, privacy-friendly Google Analytics alternative](https://wordpress.org/plugins/wp-statistics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-statistics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-statistics/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-statistics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-statistics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-statistics/reviews/)

## Tags

 * [cron](https://wordpress.org/support/topic-tag/cron/)
 * [email](https://wordpress.org/support/topic-tag/email/)
 * [hook](https://wordpress.org/support/topic-tag/hook/)
 * [report](https://wordpress.org/support/topic-tag/report/)

 * 13 replies
 * 2 participants
 * Last reply from: [pinetribewcf](https://wordpress.org/support/users/pinetribewcf/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/wp-statistics-emails-failed/#post-16603041)
 * Status: resolved