Posted by sagannotcarl on October 7, 2009 at 12:48am
| Project: | Mail Comment |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
I realized today that my issue at #466446: Upgrade breaks message cleaning was really due to the fact that Mac Mail changed what is inserted above the quoted text to use a name instead of an email (at least for me). Here is a patch that adds a second mac mail check that's a little looser. Regex is definitely not my thing so if anyone has a suggestion to make it more specific I'd be happy. I also added a line for some old versions of outlook that wasn't being caught.
For reference here are the regex's that have been added with this patch:
'mac_mail_2' => "/On [A-Z][a-z]{2} [0-9]{1,2}, [0-9]{4}, at [0-9]{1,2}:[0-9]{2} [AP]M,/",
'outlook_legacy' => '/From:(\s*)[A-Za-z0-9._%+-]+@[A-Za-z0-9._%+-]+\.[A-Za-z]{2,3}(\s*)\[mailto:[A-Za-z0-9._%+-]+@[A-Za-z0-9._%+-]+\.[A-Za-z]{2,3}\]/',This patch is for the mail2web_extras module.
| Attachment | Size |
|---|---|
| mail2web_extras.module.patch | 1.62 KB |
Comments
#1
#2
Committed, thanks Colin.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.
#4
Switch to mailcomment project. Mail2web is now known as "mailcomment" due to a trademark issue with the name mail2web.
#5
My Mac Mail (version 4.2) has the following format:
On 02 Sep 2011, at 1:05 PM, me@example.com wrote:That will need to be caught with this regex:
'mac_mail_3' => "/On [0-9]{1,2} [A-Z][a-z]{2} [0-9]{4}, at [0-9]{1,2}:[0-9]{2} [AP]M, [a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4} wrote/",#6
Patch attached.
#7
Roger, if #1188584: Email reply text not being stripped from comment body otherwise looks good to Dane, I'll roll your regex in with the rest. Also if you are feeling particularly helpful could you send me a sample message from Mac mail to my drupal.org username AT gmail dot com? I'm trying to collect messages (names and text changed to protect the innocent, of course) from various mail clients to use with the tests I wrote for mailcomment.
#8
Roger, I just updated #188584 with your regex. However I rewrote it a bit:
/On \d{1,2} \w{3} \d{4}, at \d{1,2}:\d{2} [AP]M, [a-zA-Z0-9._%-]+@?[a-zA-Z0-9.-]*[\.]?[a-zA-Z]{0,4} wrote:/Other than using the slash matching extension, I noticed you matched 2 characters for the month instead of the 3 that appear to be used. I also account for the possibility that only a username is present (it appears both 'someuser' and 'someuser@localhost.com' can be used as a username token). Thanks for the sample emails, they made testing this considerably easier!