Have installed Simplenews on Drupal 5.0 Beta2. The installation was succesful with no problems.

When I try to send e-mail, there are no mistakes written and issues are shown in the list of issues.

But no subscribers receive an e-mail (test 2 different e-mails subscribed). In log there are following mistakes for each of 2 subscribers:

- PHP: Newlines aren't allowed in the Subject header. in file /home/httpd/vhosts/s-marketing.ru/httpdocs/includes/common.inc on string 1818.
- Newsletter: Newsletter "name of newsletter" could not be sent to "my e-mail".

Instead of name of newsletter and my e-mail are right name/address of course.

Site: http://www.s-marketing.ru/ . Can provide access to admin page of site if necessary.

Comments

sutharsan’s picture

Does the problem still exist in 5.0 (final) version?

Can you confirm that the mail subject does not contain newline characters (\n or \r). Also not from the translation (try default English interface language)!

leon83’s picture

Yes, the problem is still exists in Drupal 5.0 official. I even tried to install Notify module - it shows the same mistake.

The problem is following. When I use Russian $subject in drupal_mail, it finds some 'new lines' in $subject - I belive because of encoding. I solved this problem in such harmful way: instead of $subject in Notify module (instead of SimpleNews) I changed $subject to static 'New material: ...' (in english). Now it works.

sutharsan’s picture

Thanks for sharing your solution.
drupal_mail accepts no newline characters by design:

 * @param $subject
 *   Subject of the e-mail to be sent. This must not contain any newline
 *   characters, or the mail may not be sent properly.

Therefore proper filtering/encoding should take place before calling this function.

Can you supply example(s) of failing subjects?

leon83’s picture

Unfortunately, no. I don't know how the $subject of newsletters is formed.

I tried to send 2 newsletters via SimpleNews. The subjects of topics were following:

'Оценка качества обслуживания – метод Mystery Shopping' (Russian letters + English)
'Mystery shopping' (only English ones)

Maybe my previous comment about Russian titles was wrong. Can you provide the typical Subject of newsletters from SimpleNews? I will say the translation of it in localization module. Likely the problem is simply solving by changing the translation to the right one.

sutharsan’s picture

If you are familiar with theming you can theme your mail yourselves and with this you can change the e-mail title. The standard mail title is made with the taxonomy term and node title: "[taxonomy term] node title".

This is the standard simplemail theme:

/**
 * Theme the newsletter message subject and body.
 */
function theme_simplenews_newsletter($node, $tid) {
  $term = taxonomy_get_term($tid);
  $node->subject = '['. $term->name .'] '. $node->title;
  $node->body = '<h2>'. $node->title ."</h2>\n". $node->body;
  return $node;
}
sutharsan’s picture

Status: Active » Closed (fixed)

I close this issue after some time of silence. If you need support on this same subject, please feel free to re-open the issue.