Email subject line is just ? or sometimes ??

Cromicon - July 1, 2006 - 12:29
Project:Remindme
Version:4.6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi
The reminder email subject line is only appearring as a ? or sometimes ??.

The code for the subject line seems a bit complex to me (but then all code is :-p) is there a way just to simplify it?

function remindme_mail($node) {
  $from = variable_get('site_mail', ini_get('sendmail_from'));
  $subject = variable_get('site_name', 'drupal') .' '. strtr(t('Reminder for »%title«'), array ('%title' => check_plain($node->title)));
  $to = "$node->name <". $node->mail .'>';
  $body = strtr(t("Greetings %name,\n\nYou wanted to get a reminder for the event %title. It starts at %time, you can see more details at %url . Thank you for using the Walkers Talk Remind Me! service."));

  return user_mail($to, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal (remindme.module)\nReturn-path: <$from>\nErrors-to: $from\n");
}

#1

Cromicon - July 26, 2006 - 20:48

Looking at the source of the email it seems to be something to do with utf8 to my untrained eye...

To: Admin
Subject: =?UTF-8?B?UmVtaW5kZXIgZm9yILtDb25pc3RvbiBPbGQgTWFuqw==?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-transfer-encoding: 8Bit

Is anyone else experiencing these problems?

#2

Cromicon - July 27, 2006 - 16:48

Ok this looks to be a fix. Note one the code example in my first post there are two "chevron" characters surrounding the first incidence of %title - I took them out so the code reads:
$subject = strtr(t('Reminder for %title'), array ('%title' => $node->title));
And now the subject shows correctly in the email.

 
 

Drupal is a registered trademark of Dries Buytaert.