1

I'm having problems with certain characters when using the drupal_mail() function.

Here is the apache error.log entry for the issue:

Ignoring invalid 'To:' recipient address '=?UTF-8?B?IsWgxZLFvcWhxZPFvsW4wqXCtcOAw4HDgsODw4TDhcOGw4fDiMOJw4rDi8OMw40=?= =?UTF-8?B?w47Dj8OQw5HDksOTw5TDlcOWw5jDmcOaw5vDnMOdw5/DoMOhw6LDo8Okw6XDpg==?= =?UTF-8?B?w6fDqMOpw6rDq8Osw63DrsOvw7DDscOyw7PDtMO1w7bDuMO5w7rDu8O8w73DvyI=?= =?UTF-8?B?IDxjaXRyaWNndXlAZ21haWwuY29tPg==?=' Transaction aborted: no recipients specified

For sake of example, what would be the simplest way to successfully send an email (In the RFC2822 format of "User <user@example.com>") to:

ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÍÎÏÐÑÒÓÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñóôõöøùúûýÿ <example@example.com>

Currently drupal_mail() fails with:

"Unable to send e-mail. Contact the site administrator if the problem persists."

Preferably, I would like to be able to keep these special characters intact.

Otherwise, could I use a project like Transliteration or Pathauto to convert or prepare the string? If so, which project and function should I use to prepare the "To" name?

Drupal Log Message: enter image description here

  • The watchdog log (dblog.module) should contain more information, including the actual error message. – Berdir Oct 5 '11 at 3:52
  • Attached a graphic of the error from watchdog. :) – Citricguy Oct 5 '11 at 4:47
0

All credit to @deceze

Original Solution

In short:

mb_internal_encoding('UTF-8');

$name  = '山本';
$email = 'yamamoto@example.com';
$addr  = mb_encode_mimeheader($name, 'UTF-8', 'Q') . " <$email>";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.