Subscribe to
Posts
Comments
NSLog(); Header Image

WordPress Problem: Double-Spaced Emails

I'm having problems with WordPress. Specifically, the email notifications it sends out. Have a look.

This all began when I started monkeying with my own plugin to replace two of WordPress' pluggable functions that send mail, though admittedly this was also at about the same time as the DNS began propagating and the new server started being used to send email over the old server.

The headers are really not out of the ordinary, except that SpamAssassin adds its scoring information:

Return-Path: <anonymous@barzeski.com>
Delivered-To: 1-erik@barzeski.com
Received: (qmail 28558 invoked by uid 48); 4 Nov 2006 11:42:32 -0500
Date: 4 Nov 2006 11:42:32 -0500
Message-ID: <20061104164232.28557@barzeski.com>
To: erik@barzeski.com
Subject: [NSLog();] Please moderate: "WordPress [snip] Emails"
MIME-Version: 1.0
From: wordpress@nslog.com
Content-Type: text/plain; charset="UTF-8"
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on as.barzeski.com
X-Spam-Level:
X-Spam-Status: No, hits=0.3 required=4.0 tests=NO_REAL_NAME autolearn=no version=2.63

I've re-installed WordPress from a fresh download, thinking perhaps I'd changed the line endings in one of the files somehow, but predictably this did not fix things. I've added "wordpress@nslog.com" to my server-wide white list and the SpamAssassin headers are still added (and I'm not certain it's SpamAssassin screwing things up anyway).1

So really, it seems to be something on or about the new server that's causing the problem, as yesterday saw a mix of single- and double-spaced emails (while the DNS was still propagating and some were still seeing the old server). All of today's emails have been double spaced.

Yet I'm not certain what on the new server is causing the problems. It's frustrating to say the least.

Footnotes

  1. Turning SpamAssassin off entirely results in no change.

4 Responses to "WordPress Problem: Double-Spaced Emails"

  1. I've been getting that for about a few months now, and assumed it was just a plug-in mucking about, but if it's the server (as is your case), that could clear things up. I'll keep checking this post and the comments it will receive

  2. What are the strings in the code that generate the email? If the emails are plaintext I'd guess unix line endings will give you one line, whilst windows line endings (crlf) would give you two lines?

  3. bgk said on November 4, 2006:

    What are the strings in the code that generate the email? If the emails are plaintext I'd guess unix line endings will give you one line, whilst windows line endings (crlf) would give you two lines?

    They're \r\n. I had changed them earlier and it seemed to have little effect, but come to think of it, that may have been because I was only uploading the changes to my new server, and some folks were still hitting the old one. Except… I never had any problems with this double-spacing on the old server.

    At any rate, replacing \r\n with just \n on the new server fixes things except in the comment itself. There, it's still doubled. I'll try a str_replace and report back.

  4. Erik J. Barzeski said on November 4, 2006:

    I'll try a str_replace and report back.

    Adding this in the appropriate location seems to have helped.

    $notify_message = str_replace("\r", '', $notify_message);

    I had done this in my own code, yet it wasn't working. But again, that's because I was uploading my own code to the new server, yet messages were still being created on the old server.

    Time to re-extract these methods into a plugin for my own use.


Trackback URI | Comments RSS

Leave a Reply

Please abide by the comment policy. Valid HTML includes: <blockquote><p>, <em>, <strong>, <ul>, <ol>, and <a href>. Please use the "Quote Me" functionality to quote comments.