Double Notification and Comment Emails Explained

I finally took the time to investigate why I receive two notification emails each time a comment is posted at this blog. Granted, it didn’t hurt anything, but it was annoying to get the multiple emails on my iPhone. Initially I assumed the issue had something to do with my use of the WP-Mail-SMTP plugin (which I highly recommend if you want to use GMail to send your emails from WordPress), however it turned out not to be the culprit. The problem was simply the way I had WordPress and my email configured; if you too are plagued by extra comment notification emails, read on for an explanation and solution.

It’s the Configuration

Most posts I found regarding this issue suggested the problem lay with the Settings > Discussion “E-mail me whenever” options. The two settings allow you to receive an email whenever “Anyone posts a comment” or “A comment is held for moderation”:

I send all new comments to moderation so I can filter spam by hand, so this sounded like a reasonable explanation: one email for the moderation, one email for the comment. However a simple test of these options showed them not to be the source of the problem: by unchecking “A comment is held for moderation” and leaving myself a comment, instead of two emails I received zero, which wasn’t quite what I wanted.

Not knowing what to try next in the configuration settings, I added a debug statement and stack trace to the wp_mail() function to see what was really going on. Naturally wp_mail() was called twice, but the interesting thing is that it was called with two different email addresses. And that’s when this statement from the WordPress codex finally clicked for me:

Please note that the use of “me” refers to either a post author or the administrator (person whose email address is used for admin purposes).

I am both the site administrator and the post author, and for whatever reason I had configured two different emails for those purposes, and forwarded all messages from one to the other. So, to summarize, if the following matches your situation:

  • You are both the site administrator and primary content author
  • You configure email A in Settings > General as the admin E-mail address
  • You configure a different email B as your account email in Users > Your Profile – E-mail
  • You forward email A to B, or vice versa

The solution is very easy: change one email or the other so they are both exactly the same (including capitalization), and you should not be plagued with duplicate comment notifications any longer.