Drupal allows semi-colons to delimit email addresses, but mailWithoutQueue() expects only commas.

    // Create the list of 'To:' recipients.
    $torecipients = explode(',', $to);
CommentFileSizeAuthor
#4 2671428-4.patch656 bytesNancyDru
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

NancyDru created an issue. See original summary.

NancyDru’s picture

Additionally, it requires a blank before the "<" but that is not required.

        $toparts = explode(' <', $torecipient);
NancyDru’s picture

This seems to do the trick:

    // Create the list of 'To:' recipients.
    $torecipients = preg_split('/;|,/', $to);
    foreach ($torecipients as $torecipient) {
      if (strpos($torecipient, '<') !== FALSE) {
        $toparts = explode('<', $torecipient);
        $toname = trim($toparts[0]);
        $toaddr = rtrim($toparts[1], '>');
      }
      else {
        $toname = '';
        $toaddr = $torecipient;
      }
      $mailer->AddAddress($toaddr, $toname);
    }
NancyDru’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
656 bytes

Here's a patch.

NancyDru’s picture

Priority: Major » Critical
DamienMcKenna’s picture

Priority: Critical » Major
Issue tags: +Needs tests

Would you mind adding a test to cover this scenario?

NancyDru’s picture

I don't understand the test language, so I cannot.

wundo’s picture

Priority: Major » Normal
Chris Matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll, +Needs rework

The 3 year old patch to smtp.mail.inc in #4 does not apply to the latest 7.x-1.x-dev snapshot and may be too old to reroll, but I went ahead and tagged the issue accordingly.

Checking patch smtp.mail.inc...
error: while searching for:

    // Create the list of 'To:' recipients.
    $torecipients = explode(',', $to);
    foreach ($torecipients as $torecipient) {
      if (strpos($torecipient, '<') !== FALSE) {
        $toparts = explode(' <', $torecipient);
        $toname = $toparts[0];
        $toaddr = rtrim($toparts[1], '>');
      }
      else {

error: patch failed: smtp.mail.inc:137
error: smtp.mail.inc: patch does not apply