Title: Bug with long header value &quot;from&quot;
Last modified: August 21, 2016

---

# Bug with long header value "from"

 *  Resolved [demon_ru](https://wordpress.org/support/users/demon_ru/)
 * (@demon_ru)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/)
 * classes/class-s2-core.php (356):
 *     ```
       $header['From'] = mb_encode_mimeheader($this->myname, 'UTF-8', 'Q') . " <" . $this->myemail . ">";
                               $header['Reply-To'] = mb_encode_mimeheader($this->myname, 'UTF-8', 'Q') . " <" . $this->myemail . ">";
       ```
   
 * longest string “from” is splitted to several rows with dilimiter “\n”.
 * wp-includes/pluggable.php
    function wp_mail (line 266). of all the header lines
   is only the first.
 * Yes. It is bug of wordpress. Now even publishing a test email is not sent, as
   in Russian in the “from” substituted largish text.
 * [https://wordpress.org/plugins/subscribe2/](https://wordpress.org/plugins/subscribe2/)

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

 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705040)
 * [@demon_ru](https://wordpress.org/support/users/demon_ru/),
 * Looking at some of the comments [here](http://www.php.net/manual/en/function.mb-encode-mimeheader.php)
   some of your issue may be down to your PHP version and server configuration also.
 *  Thread Starter [demon_ru](https://wordpress.org/support/users/demon_ru/)
 * (@demon_ru)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705049)
 * PHP 5.3.27
    I can not clearly explained the problem. After converting a string
   to Quoted-Printable, it becomes long. According to the RFC is transferred to 
   another line. wp_mail trying to adjust header “from” (as it seems right). It 
   spoils this header, as it leaves only one row of the total value of the (first).
 * Did I fix this server configuration?
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705107)
 * [@demon_ru](https://wordpress.org/support/users/demon_ru/),
 * Thank you for trying to explain further. So is the issue in Subscribe2, the wp_mail()
   function or the PHPMailer library?
 *  Thread Starter [demon_ru](https://wordpress.org/support/users/demon_ru/)
 * (@demon_ru)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705114)
 * It’s the issue in wp_mail() function of WordPress.
    And your plugin users are
   affected by this error 🙁
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705119)
 * [@demon_ru](https://wordpress.org/support/users/demon_ru/),
 * Are you using the UTF-8 character set on your site? (In the DB_COLLATE and DB_CHARSET
   values of wp-config.php and in the database charset in PHPMyAdmin)
 * Also, I think the issue comes from the [addAnAddress](https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-phpmailer.php#L747)
   funtion in the PHPMailer class, in particular this line:
    `$name = trim(preg_replace('/[\
   r\n]+/', '', $name)); //Strip breaks and trim`
 *  Thread Starter [demon_ru](https://wordpress.org/support/users/demon_ru/)
 * (@demon_ru)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705124)
 * UTF-8 on my site, on mysql backend.
    I am sure all is correct.
 * headers:
 *     ```
       from: line1
       line2
       line3 <from@domain.com>
       Reply-To: line4
       ...
       ```
   
 * wp-includes/pluggable.php
    line 249 foreach Analyzed only the first line. And
   headers becomes:
 *     ```
       from: <line1>
       Reply-To: line4
       ```
   
 * And the letter was not sent, as this line does not contain a domain.
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705162)
 * [@demon_ru](https://wordpress.org/support/users/demon_ru/),
 * I think this is coming from wp_mail() after all but I can’t quite figure out 
   exactly when and where it’s happening just yet – I’m getting there bit by bit
   though and could perhaps offer a fix if I get a better idea of when it happens.
 *  [Matt Robinson](https://wordpress.org/support/users/mattyrob/)
 * (@mattyrob)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705180)
 * [@demon_ru](https://wordpress.org/support/users/demon_ru/),
 * You could try this plugin which plug the core wp_mail function with a multibyte
   version:
    [https://kimmo.suominen.com/sw/mbmail/](https://kimmo.suominen.com/sw/mbmail/)
 * It does look quite old now though.
 *  [arty.name](https://wordpress.org/support/users/artyname/)
 * (@artyname)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705384)
 * I have I have just reported a WP bug for this issue: [https://core.trac.wordpress.org/ticket/28473](https://core.trac.wordpress.org/ticket/28473)

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

The topic ‘Bug with long header value "from"’ is closed to new replies.

 * ![](https://ps.w.org/subscribe2/assets/icon-256x256.png?rev=2318630)
 * [Subscribe2 - Form, Email Subscribers & Newsletters](https://wordpress.org/plugins/subscribe2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/subscribe2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/subscribe2/)
 * [Active Topics](https://wordpress.org/support/plugin/subscribe2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/subscribe2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/subscribe2/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [arty.name](https://wordpress.org/support/users/artyname/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/bug-with-long-header-value-from/#post-4705384)
 * Status: resolved