Title: Bad Headers
Last modified: August 21, 2016

---

# Bad Headers

 *  Resolved [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/)
 * 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.
 * Andy
 * [http://wordpress.org/plugins/email-users/](http://wordpress.org/plugins/email-users/)

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

 *  Thread Starter [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163181)
 * 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.
 *  Thread Starter [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163206)
 * Mike,
 * 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](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163210)
 * Andy –
 * What version of plugin did you find this problem in? Last week I found a problem
   with header construction ([see this](http://michaelwalsh.org/blog/2013/09/email-users-v4-5-3-beta-1-now-available/))
   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.
 * Mike
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163211)
 * 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.
 *  Thread Starter [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163228)
 * 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.
 *  Thread Starter [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163231)
 * 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](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163271)
 * 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 <golufk_1353242723_per@gmail.com> [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> </body></html>
 * [26-Sep-2013 11:31:54 UTC] Date: Thu, 26 Sep 2013 11:31:53 +0000
    Return-Path:
   [golufk_1353242723_per@gmail.com](https://wordpress.org/support/topic/bad-headers/golufk_1353242723_per@gmail.com?output_format=md)
   From: Development Admin <golufk_1353242723_per@gmail.com> Bcc: [mpwalsh8+mike@gmail.com](https://wordpress.org/support/topic/bad-headers/mpwalsh8+mike@gmail.com?output_format=md),
   [aarntzen@wpst.example.com](https://wordpress.org/support/topic/bad-headers/aarntzen@wpst.example.com?output_format=md),
   [abarroso@wpst.example.com](https://wordpress.org/support/topic/bad-headers/abarroso@wpst.example.com?output_format=md),
   [bstewart@wpst.example.com](https://wordpress.org/support/topic/bad-headers/bstewart@wpst.example.com?output_format=md),
   [wwong@wpst.example.com](https://wordpress.org/support/topic/bad-headers/wwong@wpst.example.com?output_format=md)
   Message-ID: <eff01f98bc73643874b6ea1dd79546d6@localhost> X-Priority: 3 X-Mailer:
   PHPMailer 5.2.4 ([http://code.google.com/a/apache-extras.org/p/phpmailer/](http://code.google.com/a/apache-extras.org/p/phpmailer/))
   Return-Path: <hope@solo.com> Reply-To: “Development Admin” <golufk_1353242723_per@gmail.
   com> 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.
 *  Thread Starter [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163293)
 * 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.
 * Thanks.
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163294)
 * I have just posted a [new beta build](http://michaelwalsh.org/blog/2013/09/email-users-v4-5-3-beta-4-now-available/)
   available which addresses this bug. Can you test it out?
 *  Thread Starter [Andy Fragen](https://wordpress.org/support/users/afragen/)
 * (@afragen)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163328)
 * 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](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163473)
 * Resolved in 4.6.0.

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

The topic ‘Bad Headers’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/email-users_a0e0cf.svg)
 * [Email Users](https://wordpress.org/plugins/email-users/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/email-users/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/email-users/)
 * [Active Topics](https://wordpress.org/support/plugin/email-users/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/email-users/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/email-users/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/bad-headers/#post-4163473)
 * Status: resolved