Plugin not sending notification emails
-
I have the default setup, and I have a valid API key, and the site is setup exactly like the two other sites I have this plugin installed on (on the same server too!) and for some reason it won’t send emails. I’m very confused!
What information would you need in order to attempt to debug/figure this out?
-
I do not know what information would be needed to troubleshoot that issue considering that you said that this website is configured exactly like two others that supposedly are working correctly.
I will add a new option in the settings page to test the ability of the plugin to send email notifications, so lets wait until tomorrow when I finish the code; with that option you could check if the email library used by the plugin is failing or if the problem resides in the scheduled tasks and we can go from there.
I will update this ticket when I finish this new option.
I finished the implementation of the option to test the ability of the server where each website is being hosted to send email alerts, here is the commit [1].
Download and install the development version of the plugin [2], go to the general settings page, and click the button that says “Test email alerts”, this will send a test message to the email addresses configured in the “Send plugin alerts to” option. Check your inbox and spam box to see if the test message is there.
Also remember that the plugin sends a maximum of five alerts per hour to reduce the noise when someone is attacking your site, otherwise your inbox may get full of unnecessary emails. You can remove this limit from the general settings page though.
The plugin relies in the WordPress function “wp_mail” [3] so any issue related with that function has to be reported to the WordPress core team [4].
[1] https://plugins.trac.ww.wp.xz.cn/changeset/1183759
[2] https://downloads.wp.xz.cn/plugin/sucuri-scanner.zip
[3] https://codex.ww.wp.xz.cn/Function_Reference/wp_mail
[4] https://make.ww.wp.xz.cn/core/handbook/reporting-bugs/Yeah, it said the alert was sent, but def didn’t show up in my inbox or spam folder.
I did a “tail /var/log/syslog” and don’t see an email coming through. My other sites once I login, I get see the email go through postfix on the server. And the site does send email, I created a test user as a check and received the password email.
So no errors, and no email. If you have any other ideas I’m all for them. Thank you for trying to help!
I will check this once again tomorrow morning.
You said that the emails for an user creation (that are sent by WordPress not the plugin) reach your inbox, so I will check the source code to see what differences are between that and the plugin’s code.
Today I spent some minutes reading through the definition of the WordPress function “wp_mail” and found that it does not handles any of the exceptions thrown by the PHPMailer library [1] which makes it difficult to debug. I will have to implement that function from scratch to get the exceptions that PHPMailer is throwing and find out why the messages are not being sent.
(Marking as unresolved once again).
[1] https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L533-L537
Thank you sir! I’m hoping that figuring this out will help others as well.
Sending email through SMTP (opposed to sendmail, the default PHPMailer setting) is more reliable.
https://github.com/szepeviktor/wordpress-plugin-construction/blob/master/mu-smtp-uri/smtp-uri.php
Just define localhost without authentication in your wp-config.php:
define( 'SMTP_URI', 'smtp://localhost:25' );Following @szepeviktor suggestion I also added a new option [1] to allow you to choose which method must be used by the plugin to send the email alerts. By default it uses the WordPress functions (which in normally circumstances should work) but you can force the plugin to use the native PHP functions.
The option will be available in the “Alert Settings” panel located in the plugin’ settings page. You will see it when the next version of the plugin is publicly released, or you can install the development archive [2] to test the new code earlier.
WordPress uses a very well known library named PHPMailer [3] to send emails, it provides a good list of options and a reliable interface to debug the communication with the SMTP server, unfortunately WordPress’s developers decided to implement this omitting the debug information [4] which makes it difficult to troubleshoot issues related with a misconfiguration of the mail servers.
[1] http://plugins.trac.ww.wp.xz.cn/changeset/1215078
[2] https://downloads.wp.xz.cn/plugin/sucuri-scanner.zip
[3] https://github.com/PHPMailer/PHPMailer
[4] https://core.trac.ww.wp.xz.cn/browser/tags/4.2.2/src/wp-includes/pluggable.php#L528
The topic ‘Plugin not sending notification emails’ is closed to new replies.