diff --git a/includes/simplenews.mail.inc b/includes/simplenews.mail.inc index 4c0ee82..362c41d 100644 --- a/includes/simplenews.mail.inc +++ b/includes/simplenews.mail.inc @@ -521,7 +521,7 @@ function _simplenews_set_from() { $name = variable_get('simplenews_from_name', $name_default); // Windows based PHP systems don't accept formatted emails. - $formatted_address = substr(PHP_OS, 0, 3) == 'WIN' ? $address : '"' . mime_header_encode($name) . '" <' . $address . '>'; + $formatted_address = substr(PHP_OS, 0, 3) == 'WIN' ? $address : '"' . $name . '" <' . $address . '>'; return array( 'address' => $address, diff --git a/includes/simplenews.source.inc b/includes/simplenews.source.inc index 54862eb..1cbd459 100644 --- a/includes/simplenews.source.inc +++ b/includes/simplenews.source.inc @@ -519,7 +519,7 @@ class SimplenewsSourceNode implements SimplenewsSourceNodeInterface { return $this->getFromAddress(); } else { - return '"' . mime_header_encode($name) . '" <' . $this->getFromAddress() . '>'; + return '"' . $name . '" <' . $this->getFromAddress() . '>'; } return $formatted_address; diff --git a/tests/simplenews.test b/tests/simplenews.test index 8010878..e9a1e10 100644 --- a/tests/simplenews.test +++ b/tests/simplenews.test @@ -1838,12 +1838,15 @@ class SimplenewsSourceTestCase extends SimplenewsTestCase { // Set the format to HTML. $this->drupalGet('admin/config/services/simplenews'); $this->clickLink(t('edit newsletter category')); - $edit = array( + $edit_category = array( 'format' => 'html', - // @todo: This shouldn't be necessary. + // Use umlaut to provoke mime encoding. + 'from_name' => 'Drupäl', + // @todo: This shouldn't be necessary, default value is missing. Probably + // should not be required. 'from_address' => $this->randomEmail(), ); - $this->drupalPost(NULL, $edit, t('Save')); + $this->drupalPost(NULL, $edit_category, t('Save')); $edit = array( 'title' => $this->randomName(), @@ -1878,6 +1881,10 @@ class SimplenewsSourceTestCase extends SimplenewsTestCase { $this->assertFalse(strpos($mail['params']['plaintext'], '')); // Make sure the body is only attached once. $this->assertEqual(1, preg_match_all('/Mail token/', $mail['params']['plaintext'], $matches)); + + // The mail system is responsible for mime encoding, make sure the from + // address is not yet encoded. + $this->assertEqual('"' . $edit_category['from_name'] . '" <' . $edit_category['from_address'] . '>', $mail['from']); } }