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.
Comments
Comment #1
gregglesThis seems reasonable to me. A patch is easier to actually review, though, so I may have more questions when I see the patch.
Comment #2
cyu commentedPatch attached. Thanks.
Comment #3
cyu commentedIs drupal_strtolower overkill to use on e-mail addresses and domains?
Comment #4
obrienmd commentedNot 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).
Comment #5
cyu commented@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.
Comment #6
deekayen commentedGit-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.
Comment #7
danepowell commentedTriggering automated testing.
Comment #8
danepowell commentedhttp://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.