I have a receiving mailbox which has been configured with an uppercase character. This creates problems when sending to gmail, for example, since they convert the address to all lowercase and then the return email is rejected. Conversely, if I config the mailbox in Drupal as lowercase, my domain servers will uppercase internal e-mails and they will be rejected. In mailcomment_mailhandler() I'd like to switch the match logic to:

  // If not a catchall, check only for direct matches
  if (in_array(strtolower($to), array_filter(mailcomment_mailboxes(), 'strtolower'))) {
    $matched = TRUE;
  }
  // Do host match for catchalls
  else if (in_array(strtolower($header->to[0]->host), array_filter($hosts, 'strtolower'))) {
    $matched = TRUE;
  }

If that looks sensible I will create a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

This seems reasonable to me. A patch is easier to actually review, though, so I may have more questions when I see the patch.

cYu’s picture

FileSize
1 KB

Patch attached. Thanks.

cYu’s picture

Is drupal_strtolower overkill to use on e-mail addresses and domains?

obrienmd’s picture

Not sure about your #3 question, cYu, but patch is working great for me and solves a problem I've run into a number of times (gmail-related, as yours was).

cYu’s picture

@obrienmd: Can't tell if you are not sure what my question is or not sure what the answer is, so I'll clarify just in case. In general drupal_strtolower() is preferred over strtolower() for unicode compatibility. I think restrictions for valid e-mail addresses and domains make it unneeded here, but I don't know for certain.

deekayen’s picture

Git-style patch of #2 attached against 6.x-1.x. I can see the maintainer has moved on, but Open Atrium, and it's large user base, are still using 6.x-1.0.

Dane Powell’s picture

Triggering automated testing.

Dane Powell’s picture

Title: Make host and mailbox comparison case insensitive » Case insensitive host and mailbox comparisons
Status: Needs review » Fixed

http://drupalcode.org/project/mailcomment.git/commit/9e5117c

Now that OA2 is in beta, this will probably be the last commit for Mail Comment 6.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.