Further to #192831: win32 PHP can't handle "Name" <address@domain.com> which included a patch for an earlier version of Drupal I would like to submit the attached patch that can be applied to Mimemail 6.x-1.0-alpha2. This will help administrators who run PHP on Windows, where the mail() function is less forgiving than other operating systems.

I will attach patch shortly.

Comments

eft’s picture

StatusFileSize
new2.62 KB

Here is the patch:

sgabe’s picture

Status: Active » Needs review

Changing status, since we have a patch waiting to review.

sgabe’s picture

Version: 6.x-1.0-alpha2 » 6.x-1.x-dev
Category: task » support

#315239: Bad address syntax on Windows is marked as a duplicate of this. I'm also changing the category and the version.

sgabe’s picture

StatusFileSize
new2.16 KB

Attaching new patch against current DRUPAL-6--1.

sgabe’s picture

Title: Helping Mimemail play nice with PHP mail() in Windows » Use simple address format for PHP mail() on Windows
Status: Needs review » Fixed

Committed to both branches.

claudiu.cristea’s picture

Status: Fixed » Active

Why not autodetecting? I'm using this function in my Views Send module to fix automatically this problem (think is inspired from Simplenews module):

/**
 * Build a formatted E-mail address.
 */
function _views_send_format_address($mail, $name, $encode = TRUE) {
  $name = trim($name);

  // Do not format addres on Windows based PHP systems or when $name is empty.
  return ((substr(PHP_OS, 0, 3) == 'WIN') || empty($name)) ? $mail : '"'. ($encode ? mime_header_encode($name) : $name) .'" <'. $mail .'>';
}


sgabe’s picture

Because it's platform independent (flexible) and IMO less ugly. :)

claudiu.cristea’s picture

With the patch, the site admin must know that on Windows systems they need to configure that... I don't think that most of them know this... They will have to investigate why mail sending fails and at the end they will find that setting and understand the meaning.

Yes... "platform independent" means exactly that the user doesn't need to perform additional settings based on platform. Ugly? Agree... but this is generated by an ugly implementation of PHP in Windows. This is addressing a bug and you can notice other similar "hacks" in Drupal.

sgabe’s picture

Okay, then let's improve the documentation. I think this option is enough to solve the problem and as we can see this is not a major issue, only a few people are effected by it. This issue is almost one year old and nobody responded to it. So I think we can live with this solution. :)

sgabe’s picture

Status: Active » Closed (fixed)

I set this to fixed. If it doesn't prove to be enough, we can deal with it then.