I'm using drupal 6.22 in english and hebrew. (simplenews 1.3)
I have a newsletter in hebrew and when the subject is in hebrew drupal just not send it. Althought with enlgish subject everything is perfect.
I installed mail log, in the logs the english subject mails looks fine, but hebrews subjects looks like this:
Hebrew mail subject:
=?UTF-8?B?W3...5M=?= =?UTF-8?B?16nXkteb?=

Comments

prokop1000’s picture

I discovered that the title is too long and it seperate it. I'm not an expert so I don't understand why it is not sent, but I wrote a validation, when editing node to throw an error, when the title is long.

function custom_module_nodeapi(&$node, $op, $teaser, $page) {
  global $user;
  // Operate only on node types set in 'simplenews_content_types' variable.
  if (!in_array($node->type, variable_get('simplenews_content_types', array('simplenews')))) {
    return;
  }
  switch ($op) {
    case 'validate':

        // Build email subject as simplenews
        if ($tid = $node->simplenews['tid']) {
          $term = taxonomy_get_term($tid);
          // Translate the newsletter term name if simplenews vocabulary uses Localized terms.
          if (module_exists('i18ntaxonomy') && i18ntaxonomy_vocabulary(variable_get('simplenews_vid', '')) == I18N_TAXONOMY_LOCALIZE) {
            $name = tt('taxonomy:term:'. $tid .':name', $term->name, $langcode);
          }
          else {
            $name = $term->name;
          }
        }
        else {
          $name = t('Unassigned newsletter');
        }
        $string = theme('simplenews_newsletter_subject', $name, $node->title,$langcode);
        /* According to encoding in unicode.inc I check if this will be long or not */
        if (preg_match('/[^\x20-\x7E]/', $string)) {
            $chunk_size = 47; // floor((75 - strlen("=?UTF-8?B??=")) * 0.75);
            $len = strlen($string);
            $chunk = drupal_truncate_bytes($string, $chunk_size);
            if ($len > strlen($chunk)) {
                  form_set_error('title', t('Title is too long, please reduce the size.' ));
            }
        }
      break;
  }
}

miro_dietiker’s picture

Double encoding is something i've seen in e.g. mimemail.
We don't encode that. The module is subject to many unclean mime implementation issues. It needs much love to follow the standards cleanly. Please help us, mimemail or your other favorite HTML-Mail module to improve.

Which module do you use?

Simon Georges’s picture

Status: Active » Postponed (maintainer needs more info)
Simon Georges’s picture

Issue summary: View changes

CHanged

oadaeh’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)

I think this can be closed as outdated.