Support » Plugin: Email Users » Bad Headers

  • Resolved Andy Fragen


    I have my email server set to toss email with bad headers as it’s usually spam.

    I recently found that Email Users is putting out an empty ‘To:’ header, at least when sending to a meta group.

    Also, it’s adding a ‘MIME Version’ header. As the WP email code also adds this header it results in a duplicate.

    The end result is email is getting discarded at the server, correctly.

    Let me know if I can explain this better.


Viewing 11 replies - 1 through 11 (of 11 total)
  • This seems to happen with emailing to groups. A test email or email to a single user doesn’t seem to result in a duplicate ‘To:’ header.


    Here’s what I found seems to work, but I haven’t tested completely.

    Comment out the following lines from email-users.php

    line 1319 – //$headers .= "MIME-Version: 1.0\n";
    line 1323 – //$headers .= "MIME-Version: 1.0\n";
    line 1407 – //$headers .= "To: \"" . $sender_name . "\" <" . $sender_email . ">\n";

    That seems to work here for both group messages and single messages.

    Plugin Author Mike Walsh


    Andy –

    What version of plugin did you find this problem in? Last week I found a problem with header construction (see this) which I believe fixes the problem with the To: header. I’ll have to look at the MIME problem as I know I didn’t do anything with it.


    Plugin Author Mike Walsh


    Based on what I fixed last week, I would not expect an email to a single user to be problematic. The problem with the TO header which I fixed was when an email was constructed for multiple recipients.

    I’m using version 4.5.2

    I haven’t looked at the beta yet but if the changes coincide with what I mentioned it should work. I’ll check it out as soon as I get a chance.

    I agree the TO header problem seemed to be only with multiple recipients.

    A quick look at the beta seems to fix the TO header. Obviously the MIME header issue remains. Take a peek, it should happen on every email.

    Plugin Author Mike Walsh


    In addition to the duplicate MIME header, I am also seeing a duplicate X-Mailer header. Do you see it as well? This is a dump of a test message with the arguments passed to PHP’s mail() function ($to, $subject, $body, $header, $params):

    [26-Sep-2013 11:31:54 UTC] ++++++++++++++++++++++
    [26-Sep-2013 11:31:54 UTC] Development Admin <>
    [26-Sep-2013 11:31:54 UTC] asdasda
    [26-Sep-2013 11:31:54 UTC] <html><head><title>asdasda</title></head><body><p>asdasda</p>

    [26-Sep-2013 11:31:54 UTC] Date: Thu, 26 Sep 2013 11:31:53 +0000
    From: Development Admin <>
    Message-ID: <eff01f98bc73643874b6ea1dd79546d6@localhost>
    X-Priority: 3
    X-Mailer: PHPMailer 5.2.4 (
    Return-Path: <>
    Reply-To: “Development Admin” <>
    X-Mailer: PHP5.3.13
    MIME-Version: 1.0
    MIME-Version: 1.0
    Content-Transfer-Encoding: 8bit
    Content-Type: text/html; charset=UTF-8

    [26-Sep-2013 11:31:54 UTC] -oi
    [26-Sep-2013 11:31:54 UTC] ———————-

    In looking through the WordPress code for wp_mail() it never checks for the X-Mailer header, which if it did, could be set for the phpMailer instance. Because it isn’t set, phpMailer adds one. The MIME type isn’t as straight forward. WordPress doesn’t look for it but similarly, it doesn’t appear there is anything to set in phpMailer for the MIME type.

    Because wp_mail() is pluggable, it is possible that some other mail implementations may be expecting these headers. I think what I will do is add options to add these headers with them off by default since the standard WordPress implementation ignores them which results in duplicate headers.

    I should have another beta release shortly.

    Clearly there are headers that are allowed to have multiple instances, like ‘Received:’, and amavisd will not complain about the message being improperly formatted.

    I think it’s probably easier to focus on the headers added by Email Users and try not to create duplicates. X-Mailer is clearly being added outside of Email Users.


    Plugin Author Mike Walsh


    I have just posted a new beta build available which addresses this bug. Can you test it out?

    I will try to do so as soon as I can but I may not be able to get to it today and I’ll bee unavailable till Monday. Sorry.

    Plugin Author Mike Walsh


    Resolved in 4.6.0.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Bad Headers’ is closed to new replies.