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.
Comments
Comment #1
sagannotcarl commentedComment #2
Ian Ward commentedCommitted, thanks Colin.
Comment #4
Ian Ward commentedSwitch to mailcomment project. Mail2web is now known as "mailcomment" due to a trademark issue with the name mail2web.
Comment #5
burningdog commentedMy 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/",Comment #6
burningdog commentedPatch attached.
Comment #7
davideads commentedRoger, 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.
Comment #8
davideads commentedRoger, I just updated #188584 with your regex. However I rewrote it a bit:
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!
Comment #9
danepowell commentedSorry, Mail Comment 6.x-1.x is no longer supported. Please upgrade to 6.x-2.x and re-open if still an issue. Thanks!